1

I'm working on ASP.net MVC3 Web application that is facing scalability issue.

For improving performance I want to store dynamically generated pages in html and serve them from generated html directly rather then querying database for each page request.

I'm sure this will dramatically increase performance.

Can any one share any hint / example / tutorial on how to do it? And what are challenges?

I would also like to know how others are handling performance issue for large e-commerce sites with at-least thousand categories and 200k products with at least 200-500 concurrent visitors? What are the best approaches?

Thanks in advance.

Dharmik Bhandari
  • 1,702
  • 5
  • 29
  • 60
  • it does if you tell it to. Static pages are kernel cached, dynamic ones are dynamic so they aren't - you have to tell it to cache them via OutputCache as mentioned below – Adam Tuliper Mar 21 '12 at 15:08

4 Answers4

2

You shoult have a look at Improving Performance with Output Caching.

It provides several ways to cache the output of your controllers like this:

[OutputCache(Duration=10, VaryByParam="none")]
public ActionResult Index()
{
    return View();
}
Marc
  • 6,749
  • 9
  • 47
  • 78
1

You don't need to do that, just enable the output cache. It will be the same, instead of hitting all your logic for creating the pages you will be retrieving a static one, but from the cache instead of disk.

Ivo
  • 8,172
  • 5
  • 27
  • 42
0

I would look at implementing a cache system for commonly viewed pages. The .Net platform has some really nice cache libraries that can be used that would allow you to manage the cache in real time.

Cache Best Practices msdn.microsoft.com/en-us/library/aa478965.aspx

I might also take a look a writing a restful API that can be load balanced across multiple nodes of a cluster.

mcottingham
  • 1,926
  • 2
  • 18
  • 28
0

Do you know where your capacity bottleneck is?

My guess is your DB is the bottleneck, but unless you measure to find out where the bottleneck is you're likely to spend a lot of time optimising things that may not make much difference.

First things to do are get hold of a copy of PAL and monitor the web server and DB to see what it tells you.

Also run SQL queries to diagnose the most expensive and frequent queries.

Measure you're actually page generation times and follow it down the stack to see what calls are being made and which are expensive and can be cached.

Rather than output caching, I'd generally introduce a caching layer infront of the webservers, and caching layer between the app server and the DB but without measuring it's very hard to judge.

If you want to know more about caching in general, I'd read this answer I wrote a while back How to get started with web caching, CDNs, and proxy servers?

Community
  • 1
  • 1
Andy Davies
  • 5,794
  • 2
  • 26
  • 21