問題描述
如何對網絡應用程序的性能進行基準測試?
How do I benchmark the performance of my web applications?
有沒有辦法找出網絡應用程序中的瓶頸?
Is there a way to find out the bottlenecks in a web application?
我不是在詢問任何前端調整,如圖像、CSS 等.我想知道的是如何分析應用程序的后端,以便我知道要修改哪些方法/查詢以提高性能.
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.
推薦答案
關于應用服務器上的瓶頸,您可以使用 分析工具,用于查看代碼的每個部分花費了多少時間、使用了多少內存等.對于 PHP,webgrind 似乎是一種流行的基于 GUI 的分析方式.像 dotTrace 之類的東西會對 ASP.NET 應用程序做同樣的事情.請注意,當涉及到數據庫時,像這樣的分析工具只會顯示哪些數據庫查詢很慢——而不是為什么它們很慢.為此,您需要查看特定于數據庫的分析...
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...
Web 應用程序瓶頸的另一個方面是瀏覽器下載所有內容(CSS 和 JavaScript 導入、圖像等)并呈現頁面實際需要多長時間.有幾家公司,例如 Keynote,他們的機器人會從世界各地訪問您的網站,分析性能,并向您提供有關更改的建議,以使您的應用輸出到瀏覽器并盡快呈現(例如,使用 gzip 壓縮并將您的 JavaScript 放在頁面的末尾而不是頭部"等).當然,您也可以在更小規模的情況下自行完成此操作.例如,像 Jiffy 和 YSlow 將完成這項工作.
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.
這篇關于有哪些方法可以找到 Web 應用程序中的瓶頸?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!