运行时适应

编程入门 行业动态 更新时间:2024-10-19 19:52:20
本文介绍了运行时适应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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;

}

更多推荐

运行时适应

本文发布于:2023-11-05 08:13:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560326.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!