Saturday, January 22, 2011

App pools on a saturday night

I needed to learn more about IIS 7.0 application pools since we're facing a problem about around 20 ASP.Net web applications residing in a single application pool and when we analyzed the IIS logs, it seems that one app is trying to be the smart ass by taking most of the resources. So, here is what I learned:

In IIS 7.0, you have the chance to group your apps into separate pools. By default, an application pool gets 1 worker process (w3wp.exe), but it's configurable. So, the default setting of one 1 worker process in an app pool means that all Applications/AppDomains in the pool share the same worker process. 

So, then comes the question: Should I put all of my applications in one app pool, or should I separate them to different app pools? What would be the pros and cons? 
Here are the facts that you should consider while making your decision:

  • App pools can be configured to use different identities. So, you can restrict one app of yours one way and your other app the other way. With app pools, you can also restrict an application access to resources in another pool. 
  • If you separate your applications to different app pools, then you can restart one app pool without affecting the other applications running in the other pools.
  • And this one is the that concerns me the most: If you have an app that is resource intensive, has memory leaks or misbehaving then you can place it in a separate app pool to ensure that it does not affect the other apps' performance.  Before IIS 7.0, if an app that is hosted under IIS crashed, it would also make its host process crash, too. So now with the app pools, you can at least keep your other good behaving apps safe and sound.
About the cons of dedicated app pools, since each app pool has its own bank of memory and its own process, it can use more system resources and there's a large memory overhead in running several w3wp.exe processes. But for me, it should be measured to see whether 20 apps in one pool use more memory then 20 apps in 20 pools, or not and then come to a conclusion. 

But anyways, maybe there should be nothing to rack your brain over on a saturday night. So, that should be all. Check these links if more is needed: [1] [2] [3]

No comments:

Post a Comment

.widget { margin-top: 30px; margin-bottom: 30px; }