HI,
我正在寻找一个案例研究,其中一个应用程序具有自适应功能已实现,可以在运行时调用。
例如:1)更改数据库连接池中的最大连接数,具体取决于工作负载。
2)数据/页面缓存量取决于内存可用性。
是否有任何可以使用的应用程序或已经实现了这样/类似的功能?请求是必须根据情况在运行时更改此参数。
据我所知,IIS具有Maxclient等参数,这些参数在设计时无法更改。
如果有任何实施,请告诉我。或者为我提供一些洞察力来开发自适应机制,比如在运行时修改数据库连接数。
谢谢
Pati
解决方案
您可以自己以编程方式管理这些事情,例如您可以使用.NET System.Management命名空间收集有关内存和CPU的信息,根据这些信息,您可以采取行动。
例如,以下是获取内存信息的方法
SelectQuery queryRam = new SelectQuery(" Win32_MemoryArray");
ManagementObjectSearcher searcherRam = new ManagementObjectSearcher(queryRam);
decimal totalRam = 0;
decimal usedRam = 0;
decimal freeRam = 0;
decimal percentRam = 0;
foreach(searcherRam.Get()中的ManagementObject manageObject
{
totalRam = Decimal.Parse(manageObject [" EndingAddress"]。ToString());
freeRam =(Decimal)new PerformanceCounter(" Memory"," Available KBytes")。RawValue;
usedRam = totalRam - freeRam;
}
HI,
I am looking for a case study where a application has adaptive features implemented, that can be invoked at runtime.
For eg: 1) change the max number of connections in the database connection pool, depending on the workload.
2) amount of data/page caching depending on the memory availablity.
Is there any application that can be used or has such/similar features already implemented? the requrement is that this parameter has to changed at runtime according to the situation.
As far as I know, IIS has parameters like Maxclient , etc which cannot be changed at design time.
Please let me if there is there is any implementation. Or else provide me some insight to develop adaptive mechanisum like data base connection count modification at runtime.
Thank you
Pati
解决方案You can manage these things programatically by yourself for example you can use .NET System.Management namespace to collect information about the memory and CPU and according to these information you can act.
For example, here is how you get the memory information
SelectQuery queryRam = new SelectQuery("Win32_MemoryArray");
ManagementObjectSearcher searcherRam = new ManagementObjectSearcher(queryRam);
decimal totalRam = 0;
decimal usedRam = 0;
decimal freeRam = 0;
decimal percentRam = 0;
foreach (ManagementObject manageObject in searcherRam.Get())
{
totalRam = Decimal.Parse(manageObject["EndingAddress"].ToString());
freeRam = (Decimal)new PerformanceCounter("Memory", "Available KBytes").RawValue;
usedRam = totalRam - freeRam;
}
更多推荐
运行时适应
发布评论