What is the difference between IIS reset and application pool recyle in affecting of cache

D.J picture D.J · Nov 23, 2011 · Viewed 44.3k times · Source

I have encountered a weird problem: as far as I know, cache can be cleared by recycling the application pool.

However, in a recent project, cache is not cleared in that way. Instead we had to reset IIS to clear the cache.

What are the differences between these actions, and what might be the cause of the differences I've experienced?

Answer

Pongsathon.keng picture Pongsathon.keng · Nov 23, 2011

When you recycle the AppPool, there is some overlap time. Your unhealthy worker process is marked for recycling, but continues to handle requests that it has already received. (It will not handle new requests). The unhealthy worker will be terminated once all its existing requests are handled.

With IIS reset, all workers are terminated and the cache in memory is cleared. New workers will be created once new requests come in.

So I think that for both an AppPool recycle and an IIS reset will clear the cache. As for as I know, that cache is stored in the Application domain. Once the unhealthy worker process terminates, all cache items should be destroyed.