App pool recycle

781 views Asked by At

We are working on an application that serves request 24 * 7 and none of the request should be missed. This application is hosted on IIS in load balanced environment. Primary server group P1 and C1, while the back up servers to primary servers are P2 and C2. So, requests are sent in load balanced manner to P1 and C1. If both P1 and C1 go down, the P2 and C2 are up. We are trying to work on a strategy so none of our requests are missed. Plan is to bring primary servers P1 and C1 down so requests are forwarded to back up. Then bring the primary servers up and work on back up servers. My question around it is how to ensure that worker process serves the last request it receives before we bring the application down for primary servers. As mentioned earlier, the intention is to ensure none of the requests are missed

1

There are 1 answers

4
James On

If you want to ensure that none of the requests are missed, you may be waiting a good long while--any requests in progress at the time the recycle occurs are serviced by the original AppPool. Depending on your site, some of those requests could be large files with very slow connections, which could take literally hours to finish. At some point you may just want to whack the connections and move on, knowing that the caller will refresh their page, reconnect, or whatever to get back to where they were.

In any case, you don't need multiple servers for this. IIS automatically (by default at least), drains requests from the old application instance while starting up the new one and sending new requests to that (during application updates). (Note however, that any requests to the new pool will likely stall for several seconds because the application is loading and initializing everything for the first time--this is normal and very difficult to avoid).

If you really do have multiple servers and want to switch request handling from one server to the other, you must have some kind of load balancing system in place, either a software load balancer such as Microsoft Network Load Balancing, or a hardware load balancer such as F5 Big-IP. In both of these situations, you have to somehow tell the load balancer to drain connections on the old application (or server) and route them to the new server. This may be done manually through their GUIs, or for an automated deployment system, will require integration with those systems.