简体   繁体   中英

ASP.NET server caching

I have a web application that runs on windows server 2008 r2. One of the pages takes too long to process when it first loads. It takes around 15 seconds and after that its almost instant. What happens is that the w3wp.exe process jumps from under 200 MB of RAM to 700 MB of RAM in this time. That is fine, the page is huge and requires that amount of memory. After those 15 seconds it switches back to around 200 MB of RAM and if anyone accesses that page it renders almost instant. Its only the first time it renders regardless of who requested it. Now after some time (minutes if not tens of minutes) when someone requests the page again, it does the same thing - 15 seconds to process and it jumps to 700 MB of RAM.

I want somehow to preserve the cache of 700 MB so it doesn't expire. Even after it falls back to 200 MB of RAM the page loads instant, but my guess is that that's why after a longer period of time it 'expires' and has to render it again. I have read about @outputcache but i'm not sure this is what i need. And there are many types of caching . Could someone point me in the right direction? I'm not worried about the memory consumption or anything else, i just don't want a user to wait 15 seconds to load it even if it doesn't happen too often. Thanks!

PS: application written in C# under ASP.NET 4.0

Your page gets compiled the first time it is being called after the start of the application pool ( http://msdn.microsoft.com/en-us/library/ms366723(v=vs.100).aspx ).

The default time-out of an iddle application pool before it shuts down is 20 minutes: http://technet.microsoft.com/en-us/library/cc771956(v=ws.10).aspx

If a new request is made after the application pool has shut down, the application pool needs to be restarted and has to compile your page again.

Besides improving caching in your application, you can do 2 things:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM