views:

4296

answers:

5

Hello!

What are optimal settings for Recycling of Application Pools in IIS7 in shared environment?

Thanks in advance

A: 

Tip: When you recycle your app, all your session variables are destroyed... so caution on this!

IMHO, keep the defaults.

Daniel Silveira
+1  A: 

How about using ASP.NET StateService? This solution is reliable and can be set as default?

GrZeCh
+1  A: 

If you have a heavy traffic site, use long recycle schedule. If you have a low traffic site use shorter/default schedule to save memory.

I learned this from Al Zabir's blog: http://msmvps.com/blogs/omar/archive/2008/10/04/best-practices-for-creating-websites-in-iis-6-0.aspx

Daniel S. is right, your session variables get destroyed on recycle, so make sure you test this well or have good error protection/recovery when getting your session objects.

Ricardo Villamil
A: 

My question was asked a little from other side (person not developing but hosting websites). Maybe I ask different question related to this topic: how can I set up IIS7 (basically I'm asking about application pool settings) for shared environment that no website could take to much resources.

GrZeCh
+6  A: 

As a Hoster, you definitely want to recycle on Memory & Time, potentially Request limits and CPU. You want to be pretty aggressive about these limits, but make sure you publish them to your clients.

Memory - 512 for an x86 box, maybe 768. For x64, you can set this much higher depending on the number of hosts per server. You just have to be careful and watch your app pool recycle events on memory issues.

Time - We typically recycle at 1 am in the morning, plus or minus (first site 1:01, second 1:11, third 1:21, just so you don't have all recycling at the same time)

Request limit - 35,000 was the default for IIS6, but this number is quite arbitrary, and very dependant on the site in question. For small usage sites, the nightly recycle will hit long before you get 35k requests.

CPU - 95%/1 minute limit/KillW3WP, but use this carefully. My understanding of this is that if the CPU hits 95%+ over the 1 minute limit for this worker process, the worker process gets killed and is unable to restart for the remainder of the limit when Action is set to KillW3WP. You might want to try NoAction initially and just watch your event logs carefully.

Recycle Event Logs - You want to make sure you are logging app pool recycles for each event threshhold that you set - i.e. if you limit based off of requests limits, make sure that Request Limit logging is enabled.

One thing to remember is that you should set deployment retail = true in the machine.config:

<system.web>
    <!--
        <deployment
            retail = "false" [true|false]
        />
    -->
    <deployment retail="true" />
</system.web>

Not setting this will allow a site to turn debugging on, which allows unlimited time outs in requests - not exactly ideal for a hoster...

Christopher_G_Lewis
Thanks. If You have any other advices how to set up correctly IIS environment for hosting please edit Your post/add new answers.
GrZeCh
You should consider the 1:1 Site to AppPool rule. With IIS 7's AppPool isolation enhancements, this prevents Application pools running under the same identity from accessing each other's memory/resources.
Christopher_G_Lewis