Outputcache - how to determine the optimal value for a duration?

I read somewhere that for a site with high traffic (I think this is also a muddy term), 30-60 seconds is a good value. Obviously, I could do a load test and change the values, but I could not find any documentation on this. Most samples have a minute, a couple of minutes. There is no recommended range. Is there something in msdn or somewhere that says this?

+4
source share
2 answers

It all depends on how often the content changes. For slow or non-mutating contents, a longer value works fine. However, you may need to reduce the value for constantly changing data or a bad failure.

+1
source

It all depends on how often the user requests your resource and how large the resource is.

First, it’s important to understand that when you cache something, this resource will remain unchanged until the cache expires. A short-term cache will impose a longer one on the web server, but a shorter one will provide more up-to-date data if the required resource change.

Obviously, you want to cache database queries as much as possible, prioritizing those that are called frequently. But the entire cache takes up memory on the server, and as resources are exhausted, the cache will be displayed. Keep this in mind when caching large items for longer periods of time.

If you need data on how often users request a resource, you can use Google Analytics , which is very easy to set up.

For very extravagant analytics, you can use Kiwik . This requires a local server.

With very changing resources, do not cache at all, unless it is really very resource-intensive and is not vital for real-time updates.

Too many variables to give you the exact number or recommendation to make you bad.

+1
source

All Articles