Por que o processo de trabalho do IIS recicla a cada 29 horas e não a cada 24 horas?

24

Quando você configura um site no IIS, o processo do operador é padronizado para reciclagem a cada 1740 minutos (29 horas). Por que um número ímpar como 29 horas e não, por exemplo, 24 ou 48 horas?

    
por Guy 10.01.2012 / 14:28

2 respostas

27
Na Tech Ed 2003, o apresentador fez esta pergunta, e a resposta foi que eles queriam um ciclo irregular para impedir que ocorresse em um limite diário (por exemplo, distinguir de outras tarefas diárias programadas no servidor / domínio).

O site aqui (link morto) especulado :

... (29 is the) first prime after 24, allowing it to have the least chance occurring in a regular pattern with any other server process; easing the investigation into problems

Outro site aparece para confirmar isto:

(Wade Hilmo) suggested 29 hours for the simple reason that it’s the smallest prime number over 24. He wanted a staggered and non-repeating pattern that doesn’t occur more frequently than once per day

    
por 10.01.2012 / 14:37
18

OK, isso estava me incomodando, então eu procurei e finalmente encontrei postando de um cara que aparentemente estava na equipe do IIS:

The reason that IIS6 recycles every 29 hours by default (and we had a reason

The reason that IIS6 recycles every 29 hours by default (and we had a reason for choosing 29 hours as the default value) is because more likely than not, the web application running on it is unreliable and literally needs to restart frequently.

Thus, IIS6 is built around the premise (admitedly cynical) that the user's web application will not run for more than 24 contiguous hours, features are planned accordingly, and defaults chosen. Worker processes recycle every 29 hours, process startup and shutdown are monitored, the process is constantly pinged to make sure it is running, the process handle is tracked and signaled when it terminates unexpectedly, etc etc.

Realizing that recycling is a normal part of operations, IIS6 also makes sure to isolate such recycling from the end user -- the end user's TCP connection never terminates during a recycle, due to some kernel-mode magic. Combined with user-mode application which stores session-state out-of-process (like ASP.Net Session State Service), one is virtually guaranteed reliable uptime with no user-visible data loss, even if the web application crashes after processing every single user request.

This is about as good as IIS6 can make it -- given an unreliable web application, make it appear reliable to the end-user, and do it without requiring any fixes of the unreliable web application.

Of course, not all unreliable application can be made to appear reliable -- if so, then we are all out of jobs! -- but IIS6 sure tries a whole lot more to be resiliant.

In your case, it just happens that the resiliancy has a side effect on non-persisted user state, but it can be easily adjusted.

Assuming your web application never has a problem and stays with in- process session state, you will want to change these defaults: 1. Turn off the 29 hour periodic recycling 2. Turn off the 20 minute idle timeout

This will prevent unexpected loss of session state.

Of course, if you ever use an application with out-of-process session state, you can leave everything as the defaults and never notice a difference in functionality nor reliability.

    
por 10.01.2012 / 14:54