The Effects of ASP.Net Caching

By Deane Barker on March 17, 2006

For all my issues with .Net — and there are many — it does have a great caching system. With one line at the top of a page (the “OutputCache” directive), you can store a page in memory for X number of seconds. It’s brutally simple, and just as effective.

I’m getting close to finishing up a project involving a commercial CMS based on ASP.Net. I started to do some load testing using Microsoft’s handy Web Application Stress Tool.

First, the baselines for a quad 3.8 GHz Xeon with 4GB of RAM:

  • Static HTML page: 938 requests per second (RPS)
  • Static ASPX page: 707 RPS

Now for some CMS-enabled pages

  • Simple page with a single content element: 220 RPS
  • Complex page with multiple elements, including some requiring security checks and recursion: 7 RPS

Ouch. That’s not gonna fly given my usage projections.

But what I’ve found is that caching even for the barest amount of time makes a stunning difference. On a five-minute test, the same page from above that only did 7 RPS, did this:

  • 60-second cache: 308 RPS
  • 30-second cache: 303 RPS
  • 10-second cache: 275 RPS
  • 5-second cache: 295 RPS
  • 2-second cache: 264 RPS

(I don’t know why the 5-second cache performed better than the 10-second cache. I don’t know if the 5-second number was abnormally high, or the 10-second number was abnormally low. It could have just been a testing anomaly — I only ran the test once for each interval.)

I think I’m going with with 30-second plan. Needless to say, my blood pressure has dropped considerably.

Gadgetopia

Comments

  1. Are you running this app using Mono on an LAMP system for those numbers or a Windows server system?

  2. Are you running this app using Mono on an LAMP system for those numbers or a Windows server system?

    Windows Server 2003.

  3. What type of architecture do you have? Is the web tier on the same machine as the database? Have you looked at performance counters or another profiler?

    Your testing methodology seems insufficient, but I assume the app feels ‘laggy’ to you.

    We’ve got a CMS that does extensive work for each request since each page is data driven but has it’s own access control list entry in our database which is checked. It handles 500 rps with less hardware than you have and zero caching. CPU utilisation is normally not a limiting factor but the naive often believe CPU determines performance…

    Either you have a seriously complex system, or you have seriously poor code/architecture. I would bet it’s the latter, you are probably screwed if the issues are in the 3rd party code and you can’t update it.

  4. Either you have a seriously complex system, or you have seriously poor code/architecture. I would bet it’s the latter, you are probably screwed if the issues are in the 3rd party code and you can’t update it.

    I’ve discussed this with the vendor, and there’s a specific situation with exactly what I’m doing which is causing the performance problems. I went a bit “outside the lines” with one of their components.

    But, regardless, so long as I cache, then I’m quite happy.

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.