Tuesday, April 29, 2008

ASP.net caching not working?

You may have developed a site in your development environment, which is usually your desktop or notebook. You carefully created a site using the ASP.net caching features. It works great in development. Caching works just as expected. Pages, controls expire just when you expect them to. Everything is perfect.

Then you put your web site on production hoping caching features will make your site faster and leave some breathing room on your server. When you notice caching didn't work on your production web site you can get pretty frustrated.

That's what happened to me when I noticed my web site www.zirve100.com didn't cache the components it was supposed to. I added hidden datetime values in my pages to see if caching was working as predicted.

What I noticed was, caching was working for a while and later it would stop altogether. None of the components that required caching would cache anymore.

After got convinced that I had the correct settings in my configuration files and some searching on the web I found out that asp.net would stop caching your pages after memory utilization was over 90%. My SQL server is on the same machine with IIS, so SQL and IIS were racing for more memory leaving only about 3-4% free.

After fixing SQL server memory to a limit where it wouldn't affect IIS memory usage ASP.net caching started working again.

No comments: