开发者

Finding out what's slowing down ASP.NET pages

I have a rather 'heavy' ASP.NET page, and currently the speed is fairly unacceptable - there is a lot of database communication, and displaying large grids. But I effectively want to find out what's actually causing the most slowdown, and working from there.

Are there an开发者_Go百科y tools built into Visual Studio 2008, or any third party tools, that'll allow me to do this?


You could use ASP.Net Trace to figure out what is slowing down in the page.


Another good tool and easy to use, https://addons.mozilla.org/en-US/firefox/addon/yslow/

Not aimed directly at code, but is very helpful with resources


Have you heard about profiling?

My favorite tool is RedGate's Ants Performance Profiler.


An easy approach is using Stopwatch. Something like this:

void SlowMethod()
{
   Stopwatch timer = new Stopwatch();
   timer.Start();
   //a lot of DB operations
   timer.Stop();
   //record timer.Elapsed

   //restart the timer and check another piece of code
   //at last find the bottle neck of the method
}


What Muhammad said - add tracing to your code to identify the slowest bits.

Also if you think db activity could be responsible, you could run SQL profiler to identify any long running queries - this will also help you correct indexes.


Some ideas:

Visual Studio Team System has a built in profiler. In VS 2010 this is available in premium and above.

Otherwise red-gate has a good profiler available. (for a fee).

Try using the tracing functionality built into asp.net.

Try using client side developer tools like Yslow and Page Speed or fiddler to see the requests for a page and their size and timings.

If you haven't already done so, make sure your server is serving gzipped content. This is an easy win.

Use SQL Server Profiler to profile your database requests.


There are many profiling tools available, I personally like ANTS Profiler, it is quite good. Check out the following link for more information on out to use it: ANTS Profiler

And here is a link to the ANTS Profiler download: 14 Day Free Trial

But if there is a lot of database communication, it is most likely the cause. Try minimizing the number of database calls and improving the performance of your database queries.

Also make good use of cacheing!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜