What are the ways to find bottlenecks in a web application?

谁说胖子不能爱 提交于 2019-12-18 11:07:22

问题


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.


回答1:


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.




回答2:


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/




回答3:


Tracing is a great start




回答4:


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




回答5:


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)




回答6:


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.




回答7:


Related threads:

  • Asp.Net Performance Resource / book
  • ASP.NET Stress Testing
  • Profiling ASP.NET websites with EQATEC Profiler
  • Load Testing Software



回答8:


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.




回答9:


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.




回答10:


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.




回答11:


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.



来源:https://stackoverflow.com/questions/514653/what-are-the-ways-to-find-bottlenecks-in-a-web-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!