runtime adaptation RRS feed

  • Question

  • 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



    Thursday, September 2, 2010 4:31 AM

All replies

  • 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;




    Ali Hamdar (
    Friday, September 3, 2010 8:21 AM
  • Hi Ali Hamdar,


    Thank you for the reply. Your response is really useful for monitoring part.

    But, what are the things in the application I can change at runtime to maintain these properties (eg : response time, CPU, Memory) at desired level. For example(number of user in the site, data base connections). What are the effective parameters i can alter at runtime?

    Also do you know a way to monitor/calculate the average response time of web pages (may be ever1 min)?


    Thank you


    Friday, September 3, 2010 9:12 AM