View Complete Thread
  • Unlock your iis7-aspnet performance

    Feb 18, 2011 10:09 AM|foxontherock|LINK

    After 4 months of optimizing every line of code, every stored procedure, every index, adding a web farm, adding computed fields and triggers, cleaning every line of code, we found what causes headaches and performance issues, and I'll share it with you.

    We are using IIS to run 10 sites, with isolated application pools. 1 of these site is an API build with asp.net that get 15-20 calls every seconds for our main asp3 classic application. The other sites are both asp classic and aspnet sites.

    Once every 2-3 minutes, ALL our asp.net processes were locked for 10-15 seconds.

    We noticed recently that, each time we get the downtime, the "gen2 collection" performance counter increased just before the downtime.

    After reading a lot of articles and researches, I found this:

    http://msdn.microsoft.com/en-us/library/ff647787.aspx

    The magical answer is at the end of the article:

    Configuring the Workstation GC

    gcServer enabled="false"
    gcConcurrent enabled="false"

    That solves all our troubles. After adding this, we see that "gen2 collections" happen more often, once every 15-20 seconds instead of every 2 minutes, each process is isolated, if site1 is cleaning its memory, site 2 is not affected, and, overall we do not get any downtime anymore!

    Why is this setting not the default setting?

    gcserver is enabled by default on asp.net applications even if the documentation say that is it disabled by default. That causes the GC to be global to all applications. It waits longer before doing a gen2 cleanup, and when it does it, it takes a long time and lock every asp.net processes. for instance, before doing the change, we got around 1600 Gen2 collections in 5 days. Since the change, yesterday, we are now at 9000 Gen2 collections. It collects more often and more quickly without blocking other processes.

    I suggest to Microsoft to set these 2 setting as the DEFAULT SETTINGS for all servers. That's like night and day for our application. That simply saved our life, as customers were calling us to close their accounts because of bad performance issues.

    I post this article to maybe help someone who have the same issue.

    memory management garbage collection gcserver aspnet.config