views:

727

answers:

11

How do I benchmark the performance of my web applications?

Is there a way to find out the bottlenecks in a web application?

EDIT: I am not asking about any front end tweaks like images, css etc. What I want to know is how to profile the back end of the application so that I will know which methods/queries to modify to increase the performance.

+2  A: 

Tracing is a great start

RandomNoob
A: 

Hello,

Could you be more specific about the platform (XP, Vista, Server 2000, 2003, 2008) and method of running the application (IIS, Windows Service). As mentioned above tracing is a good start but there are other tools depending on the environment the web application is configured on as well.

+5  A: 

Regarding bottlenecks on the application server, you can use a profiling tool to see how much time is spent in each part of your code, how much memory is used, etc. For PHP, webgrind seems to be a popular, GUI-based way of profiling. Something like dotTrace would do the same thing for an ASP.NET app. Note that when it comes to databases, profiling tools like this will only show you which database queries are slow--not why they are slow. For that, you'd need to look into database-specific profiling...

Another aspect of web app bottlenecks is how much time it actually takes a browser to downlad everything (CSS and JavaScript imports, images, etc.) and render the page. There are several companies like Keynote who have bots that will hit your site from all around the world, analyze the performance, and give you recommendations about changes you can make to get the output of your app to the browser and rendered as quickly as possible (e.g., "use gzip compression and put your JavaScript at the end of the page instead of the head", etc.). You can also do this yourslelf on a much smaller scale, of course. For example, Firefox plug-ins like Jiffy and YSlow will do the job.

Clint Harris
+4  A: 

For any web app, you can try using the Firebug extension, along with the Yahoo YSlow extension (to Firebug). Really helpful in page performance. http://developer.yahoo.com/yslow/

Mark Unwin
client-side though, doesn't help with problems upstream
annakata
A: 

If you use Perl then Devel::NYTProf is super amazing.

I have a tutorial that I have done a few times at OSCON and the MySQL conference about "Real World Web: Performance & Scalability" (slides available in PDF), you might find it interesting.

Ask Bjørn Hansen
+1  A: 

Fiddler is good tool for traffic logging and monitoring. It works on client and you can see what requests and answers go between client and web server. You can easily analyze slow pages and detect reasons (to many requests, large page, ...)

Specifically for ASP.Net, there is tracing mechanism which can create detailed log for web applications. Log shows timing information and you can find long running functions. (MSDN article: ASP.NET Tracing Overview

zendar
A: 

First step is quick-and-dirty. Try it on an iPhone, a laptop with a 3G connection, a pc with a satellite internet connection and a windows mobile PDA. If that works, you're done. If not, triangulate.

Stephan Eggermont
A: 

Turn on the trace feature, trace=true if it's a web app and put in trace statements at the beginning and end of your methods that fire. This will give you a very detailed readout of the ticks in the system and consequently how long each part takes to run.

If you have a library that is being called then you can also do the trace in it by using httpcontext.Current.Trace.Write to output what you need to look at. Alternatively if your app is really finicky you can write your own function to store the trace statements in a shared variable and write it out to a DB or other mechanism once the script has run.

Middletone
A: 

try using some test engines such as PHPUnit to stress your application, and use your shell to see what process are taking longer to resolve.

on Unix/Linux you may use the 'top' command

on Windows use the task manager (extended)

PERR0_HUNTER
A: 

If you want a generic way to find bottlenecks, try using a HTTP monitoring tool. This allows you to see what types of requests are taking longer, or if they are returning error messages. You can then use a platform specific profiling tool to zero in on specific areas of your application based on the data from the tool.

I like using a HTTP proxy tool like Charles to do this type of analysis.

Flynn81