152

Will it be disabled if I set the idle time-out to 0?

Grace Note
  • 3,205
  • 4
  • 35
  • 55
123
  • 1,557
  • 2
  • 9
  • 3

3 Answers3

189

Yes, setting the idle timeout value to zero will disable idle timeouts.

Oddly this isn't documented in the MS docs but my evidence for this arises from:

  • IIS Settings Schema

    If you have a look at the IIS settings schema in:

    C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml

    The schema definition for idleTimeout under

    <sectionSchema name="system.applicationHost/applicationPools">

    it looks like:

    <attribute name="idleTimeout" 
           type="timeSpan" 
           defaultValue="00:20:00" 
           validationType="timeSpanRange" 
           validationParameter="0,2592000,60"/>
    

    If you look at the validationParameter attribute we see a range of 0 to 2592000 seconds (the ,60 specifies the granularity of the setting, in this case the value must be divisable by 60 [one minute]).

    If you see a starting permissible value of 0 then that usually indicates the setting can be disabled.

  • IIS7 Application Pool Idle Time-out Settings

    Brad Kingsley is the founder and CEO of OrcsWeb who are a fairly well known, respected and trusted Microsoft hoster and Gold Partner.

  • Then there's also the empirical evidence of the fact that it "just works".

ZuoLi
  • 383
  • 2
  • 14
Kev
  • 118,037
  • 53
  • 300
  • 385
  • 3
    a headsup to others - after reading this, i set my idle timeout to 0 on IIS7 and it started timing out immediately - every page load took 15 seconds or so. i've now upped it to 600 and everything is blazingly fast again. – nailitdown Oct 26 '12 at 02:51
  • 1
    @nailitdown: You might want to double-check that. I just set my IIS6 app pool timeout to 0, and it works fine. There's a chance it's different between IIS7/IIS6, which would be good to know. – Doug S Nov 17 '12 at 08:22
  • 1
    @nailitdown - sounds like there's something else misconfigured with your IIS7 environment. – Kev Nov 18 '12 at 02:07
  • 3
    since i posted that we had multiple problems with the VPS i was working with... quite likely it was misconfigured somehow. I just tried to duplicate it on the new VPS, and it behaves properly, as described. – nailitdown Dec 04 '12 at 08:30
  • I just found out that changing this setting causes an instant application pool recycle :/. On a site with significant traffic and/or long startup time, this is a great way to take your site offline for a while... (Maybe this is what happened to you too @nailitdown) – Zero3 Nov 25 '16 at 10:37
  • 3
    @Zero3 - well....before changing _any_ setting on a high traffic site you should always test for side effects etc on your staging/QA environment. Also during the time you're applying the change to your production environment then you really ought to throw up a maintenance page for public facing users until such time the change has taken effect. You need to manage these changes so that there's no surprises. – Kev Nov 25 '16 at 10:51
  • @Kev Since I was not prompted/warned about a recycle when I changed the setting in the IIS manager, I had not seen it coming. The recycle was instant on the low-traffic staging environment, and thus went unnoticed there. I think it would be fair to expect the official management software to warn you if changing a simple timeout setting causes an instant reboot of your site... – Zero3 Nov 27 '16 at 17:22
  • I've submitted a doc update to https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/processmodel to add that IdleTimeout 0:00:00 disables idle timeout, which it does from fairly long experience. – TristanK Jan 10 '18 at 21:25
  • 2
    @Zero3 - yep, changing many of the App Pool settings require a process restart to take effect, which by default happens straight away. You can change this with the DisallowRotationOnConfigChange - see https://serverfault.com/questions/333907/what-should-i-do-to-make-sure-that-iis-does-not-recycle-my-application for a bit more on that. – TristanK Jan 10 '18 at 21:27
12

Great answer! thanks Kev!

A small update: the URL you posted has moved and it is now: http://bradkingsley.com/iis7-application-pool-idle-time-out-settings/

I was wondering if there is a reason why this is not the default, and if there might be a performance impact for keeping the application pool open for too long. Well, keeping it up when it is idle will not cause you more trouble than not recycling it when there is traffic and no idle time. If you are worried about memory leaks or other resource leaks, there is a setting for forcing recycling based on time/number of requests since last recycle/memory consumption. Here is the documentation for it:

http://technet.microsoft.com/en-us/library/cc753179(v=ws.10).aspx

I am going to set my server to no recycle on idle (idleTimeout=0), and recycle every 24 hours: Recycling > Regular Time Interval = 1440

Shay Mandel
  • 121
  • 1
  • 3
  • 15
    You are probably better advised to set your recycle to a fixed time (e.g. 0100) rather than 24 hours as that will result in 24 hours since last server restart / iis reset. – Neal Jan 06 '14 at 19:24
2
Import-Module WebAdministration

$pools = Get-ChildItem iis:\apppools

foreach ($pool in $pools)
{ 
$poolname = $pool.Name

Set-ItemProperty IIS:\AppPools\$poolname -name processModel -value @{idletimeout="20"}
Set-ItemProperty IIS:\AppPools\$poolname -name processModel -value @{idletimeoutaction="Suspend"}
set-ItemProperty IIS:\AppPools\$poolname -Name Recycling.periodicRestart -Value @{time="0"} 
set-ItemProperty IIS:\AppPools\$poolname -Name Recycling.periodicRestart.schedule -Value @{value="02:00:00"} 
Set-ItemProperty IIS:\AppPools\$poolname -name Recycling -value @{logEventOnRecycle="Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory"} 

Write-Host "Updated $poolname settings" 
}
help-info.de
  • 6,695
  • 16
  • 39
  • 41