Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We're running a Win 2008 R2 server with IIS 7.5 for serving image files.

It's only used for static content, and file caching has been set up to cache files for 10 minutes.

However the IIS frequently completely flushes the cache (seen by using Perfmon)

It's not application pool recycling, it's not because the TTL has expired, so now I'm at a loss :-(

I've included a screenshot of the perfmon graph where you can clearly see the issue.

Is there anywhere I can see WHY it's doing these flushes ?

(Note: I'm aware I could maybe detect it by attaching a debugger to the process, but that's not an option because it's a production server, and it cannot handle the slowdown a debugger would cause)

Perfmon screenshot

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Finally found the answer to the problem.

We had this in our web.config for the site (despite not running any managed code on the site)

<caching enableKernelCache="true">

After changing this to false the IIS stopped doing these full flushes. It still flushes some files regurlarly, but it's no longer a complete flush (around 50k files stay in cache)

Our file cache hit % has increased from 5% to 33%, so this definately helps a lot.

Not sure why kernel caching causes this behaviour, but I can live with the slight overhead of caching in usermode.

Thought I'd add this as an answer to help others with similar issues.

share|improve this answer

How often are the unique URLs to the images accessed? If the URLs haven't been fetched for 120 seconds by default, they're flushed.

See UriScavengerPeriod registry key in http://support.microsoft.com/kb/820129.

Determines the frequency of the cache scavenger. Any response or fragment that has not been accessed in the number of seconds equal to UriScavengerPeriod is flushed.

share|improve this answer
    
I'm not using Output caching so I thought the UriScavengerPeriod wasn't used. I will try changing it and see if it makes a difference. In general though the URLs are accessed multiple times per minute, so I don't think this is the cause. Also I'd expect it to only flush some files, rather than completely emptying the cache. –  Steffen Nov 15 '12 at 10:31
    
Tried increasing UriScavengerPeriod now, it didn't change anything unfortunately :-( –  Steffen Nov 15 '12 at 10:55
    
I forgot to mention the 2 in 10 default rule for caching. File has to be considered hot to get into cache which is access 2 in 10 seconds. Multiple times per minute might not be frequent enough. But that doesn't seem to be your issue since you already built cache up, then it empties. –  generalnetworkerror Nov 17 '12 at 10:43
    
See http.sys caching description in detail at blogs.iis.net/rickjames/archive/2007/11/01/…;. That sawtooth graph certainly looks like something is causing the app pool to crash or recycle. And #2 on this page is close to what you show: blogs.msdn.com/b/friis/archive/2011/01/12/… –  generalnetworkerror Nov 17 '12 at 10:58
    
Make sure nothing is touching the files to change them every few minutes as that could trigger a flush. –  generalnetworkerror Nov 17 '12 at 11:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.