ASP.NET Micro Caching: Benefits of a One-Second Cache
page 7 of 7
by Steven Smith
Average Rating: 
Views (Total / Last 10 Days): 51228/ 97

Analysis and Summary

Clearly, even just a second's worth of caching can have a big impact on performance for a high-volume application.  It's easy to see why this is the case if we look at the database's performance during this test.  I ran the test with two performance counters:

SQLServer:SQL Statistics\Batch Requests/sec
ASP.NET Apps v1.1.4322\Requests/Sec\myapplication

In the non-caching test, the SQL Server requests/sec counter averaged 56.2 requests per second.  In the micro-caching test, it averaged 1.0 request per second.  Obviously, the database was not having to do nearly as much work.  However, not all of the savings were on the database side.  Loading data into a DataSet is relatively expensive as well, as is data binding.  Although there aren't any performance counters for these activities specifically, we know they were occurring once per request in the first case, and once per second in the latter case, so we dropped a lot of work from the ASP.NET engine's plate as well. 

Typically, the database and the web server will reside on separate boxes.  The reduction in database load would clearly benefit the database server, which is a very good thing since, historically, database servers are much more difficult to scale out than web servers.  In addition, it will reduce network traffic between the web and database servers, which will further enhance performance, and the reduction in web server load is also helpful, of course, since it reduces how many web servers would be needed (or how powerful each one would need to be).


Caching is a very useful tool to take advantage of when designing applications.  It is not a panacea, and like any tool, it can be used improperly.  But even in situations where data needs to be up to the second, adding one second's worth of caching can make a big impact on application performance.  Remember to ask your users how much they can tolerate out-of-date data and try to get them to at least sign off on one-second-old data if you can, since that will allow you to take advantage of techniques like the one described here.

View Entire Article

User Comments

Title: Effective   
Name: Sangam Uprety
Date: 2009-08-20 7:36:29 AM
I tested the same using badboy and saw the differences myself. Page level output cache improves performance, like the caching of data in BLL. I just wonder why there is so few discussions on this technique. And is 1 second the minimum possible page output cache duration? Further, what about pushing it upto 10 seconds?
Title: good   
Name: mcgyver
Date: 2009-07-08 1:14:06 PM
my company is an equities broker and we have an ajax webbroker. There are about 100 more liquid assets, but 1000s of clients. Probably this aproach will diminish our hardware uses
Title: Simultaneous requests   
Name: The Chief
Date: 2006-05-18 8:10:20 AM

If it takes 0.5 seconds to load data and render the page and the server receives 20 requests within this time, does hold off processing the other 19 requests for the same page until it has finished rendering and caching the output from the first of these 20 page requests?

Your results would suggest that this is indeed what is happening but would appreciate confirmation of this.

We use caching on a busy e-commerce site, but there is still a bit of a hit on the server when the site restarts as all the output on each different category page is loaded and cached at the same time. I'm wondering whether the same data is being loaded twice via multiple requests.

Title: Caching   
Name: Arpi
Date: 2006-02-09 6:57:03 AM
This article explain right.Hence I want to know how can we stop caching of the system
Title: Not So Silly   
Name: Steven Smith
Date: 2005-07-28 8:32:35 AM
Not so - consider a news site like With their traffic I'm sure certain articles are read more than 1/second, and I'm willing to bet their articles are stored in a database. The same is true for an eBay auction nearing its end, or a popular book. There are plenty of large scale applications that could theoretically benefit from this technique. That said, you have to test your own application using realistic usage data for your app, then set the cache duration to something that makes sense for you.
Title: Silly   
Name: Cookie Monster
Date: 2005-07-28 3:05:54 AM
This is silly. Only in this test would a 1 second cache make this large of a difference. In the real world, users wouldn't be accessing the exact same piece of data so often, so basically every request would end up a cache miss.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-02-27 12:02:46 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search