views:

457

answers:

6

What all can we do to make a asp.net web application run faster than before. What are all the tweaking required for it ?

+4  A: 

Caching -- both page and data -- and optimizing data access are probably the key elements to improving performance without changing the hardware. Beyond that you can look at clustering/load balancing to make more resources available.

tvanfosson
+2  A: 

To make any application run faster, first find out where it's spending its time, then make it spend less time there. Use a profiler.


A profiler simplifies the process of breaking your application into smaller pieces and then speeding up the individual pieces. You can do that on your own if you can't afford a profiler.

For instance, you say your average response time is 4-5 seconds. That's a long time. What's going on in those 5 seconds? Is it all waiting for the database? You can try running your queries outside of the application to see how long they take. You can run SQL Server Profiler to record your database transactions during a period of time, then running the result through the Database Tuning Wizard. It may have some recommendations for changes to the indexes of the database.

You can use Fiddler, or turn on page tracing to find out whether your pages are too large. Tracing can tell you how long particular phases of page operations are taking. Maybe you're taking to long to render certain pages.

Also, you need to look at the performance of your server. Are you using too much CPU? Too much memory? Are you spending your time with page thrashing, knocking the pages of the ASP.NET worker process out of memory in order to bring in the pages of SQL Server, only to have those pages knocked out when the database query completes and the worker process needs to run again?

Break the problem down into smaller pieces, then fix the pieces.

John Saunders
With web apps, it's not always quite so easy....
RickNZ
Why not? Have you tried dotTrace from JetBrains? It does a fine job of profiling ASP.NET applications.
John Saunders
are these profiler tools freeware ?
HotTester
No. I don't know of any freeware profilers.
John Saunders
A: 

Performance tuning for ASP.NET is a big subject. In fact, in an attempt to provide a comprehensive answer to your question, I wrote a book about it: Ultra-Fast ASP.NET: Build Ultra-Fast and Ultra-Scalable web sites with ASP.NET and SQL Server.

My approach is largely prescriptive, rather than theoretical. You might take a look at the reviews on Amazon for more details about what I mean.

RickNZ
Added to my book queue. Thanks for linking it.
Paperjam
A: 

I agree with caching. ASP.NET does have great built-in caching mechanisms.

I also would recommend profiling the application, like it was already recommended above.

Here's a link to an article about some free .NET profilers, and paid ones too.

http://www.devcurry.com/2009/11/free-net-profilers-and-some-paid-ones.html

edit: you might want to check out this StackOverflow thread as well

http://stackoverflow.com/questions/308816/any-good-free-net-profiler

Hope this helps.

silverCORE
A: 

This is a big topic, but the main things that come to mind:

  • keep viewstate size down
  • fewer postbacks. Use javascript to avoid them when possible. The validation controls are a good example of how this can work.
  • have a good caching strategy

There's also non-asp.net-specific things, like these:

  • make sure your database queries aren't bogging you down
  • minimize http requests
  • keep static resources in a separate cookieless domain
  • profile before you spend time optimizing so that you don't waste time optimizing the wrong thing

You might also find this question helpful:
http://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site

Joel Coehoorn
A: 

I made kind of checklist for myself first and later I thought it would be also beneficial for others. I gathered things together and it became kind of a big checklist and wanted to share them as entries. Here it is;

http://www.yasarmurat.com/Blog/28/tuning-optimizing-increasing-and-improving-performance-of-asp-net-application-part-i.aspx

Hope it can help someone.

Regards, Murat.

Murat Yasar