在过去,我使用微软Web应用程序压力测试工具和Pylot对Web应用程序进行压力测试。我写了一个简单的主页、登录脚本和站点演练(在一个电子商务网站中添加一些商品到购物车和结帐)。
只要让少数开发人员在主页上使劲敲一下,就几乎总能找到一个主要问题。更多的可伸缩性问题将在第二阶段浮出水面,甚至更多——在发布之后。
我使用的工具的URL是Microsoft Homer(又名Microsoft Web Application Stress Tool)和Pylot。
这些工具生成的报告对我来说没有多大意义,我花了很多时间试图弄清楚站点能够支持什么样的并发负载。这总是值得的,因为最愚蠢的错误和瓶颈总是会出现(例如,web服务器配置错误)。
你做了什么,你使用了什么工具,你的方法有什么成功?对我来说,最有趣的部分是提出某种有意义的公式,用于从压力测试应用程序报告的数字中计算应用程序可以支持的并发用户数。
这是给JMeter的另一票。
JMeter是一个开源的负载测试工具,用Java编写。它能够测试许多不同的服务器类型(例如,web, web服务,数据库,基本上使用请求的任何东西)。
然而,一旦你开始面对复杂的测试,它确实有一个陡峭的学习曲线,但它是非常值得的。您可以非常快速地启动并运行,这取决于您想要进行哪种类型的压力测试,这可能没问题。
优点:
Open-Source/Free tool from the Apache project (helps with buy-in)
Easy to get started with, and easy to use once you grasp the core concepts. (Ie, how to create a request, how to create an assertion, how to work with variables etc).
Very scalable. I've run tests with 11 machines generating load on the server to the tune of almost a million hits/hour. It was much easier to setup than I was expecting.
Has an active community and good resources to help you get up and running. Read the tutorials first and play with it for a while.
缺点:
The UI is written in Swing. (ugh!)
JMeter works by parsing the response text returned by the server. So if you're looking to validate any sort of javascript behaviours, you're out of luck.
Learning curve is steep for non-programmers. If you're familiar with regular expressions, you're already ahead of the game.
There are large numbers of (insert expletive) idiots in the support forum asking stupid questions that could be easily solved if they'd give the documentation even a cursory glance. ('How do I use JMeter to stress-test my Windows GUI' shows up quite frequently).
Reporting 'out of the box' leaves much to be desired, particularly for larger tests. In the test I mentioned above, I ended up having to write a quick console app to do some of the 'xml-logfile' to 'html' conversions. That was a few years ago though, so it's probable that this would no longer be required.
我也投票给jMeter,我想在@PeterBernier的回答中添加一些引用。
负载测试回答的主要问题是有多少并发
我的web应用程序可以支持哪些用户?为了得到正确的答案,
负载测试应该代表真实的应用程序使用情况,接近于
可能的。
请记住,jMeter有许多构建块逻辑控制器,配置元素,预处理器,监听器,…这对你有帮助。
你可以模仿真实世界的情况与jMeter,例如,你可以:
Configure jMeter to act as real Browser by configuring (concurrent resource download, browser cache, http headers, setting request time out, cookie management, https support, encoding , ajax support ,... )
Configure jMeter to generate user requests (by defining number of users per second, ramp-up time, scheduling ,...)
Configure lots of client with jMeter on them, to do a distributed load test.
Process response to find if the server is responding correctly during test. ( For example assert response to find a text in it)
请考虑:
It is easy to start a real web application test with jMeter in minutes. The jMeter has a very easy tool which record your test scenario ( know as HTTP(S) Test Script Recorder).
jMeter has lots of plugins at http://jmeter-plugins.org.
The jMeter UI is swing based and has made good changes in jMeter 3.2. On the other hand please consider that JMeter GUI should only be used for test and debugging. It is not good practice to use it in GUI mode for actual test. https://www.blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui. Configure and test your scenario and run it on non-gui mode.
The are lots of reporting showing tools in jMeter (Known as listeners) but there are not meant to be on during test. You must run your test and generate reports ( .jtl files). Then you must use these tools to analyze result. Please have a look at https://www.blazemeter.com/blog/jmeter-listeners-part-1-basic-display-formats or https://www.tutorialspoint.com/jmeter/jmeter_listeners.htm.
https://www.blazemeter.com/jmeter提供了非常有用的信息,可以帮助您配置测试环境。
来这个派对有点晚了。我同意Pylot是目前最好的开源工具。它使用简单,是由一个伟大的人(科里·戈德堡)积极工作。作为OpenQA的创始人,我也很高兴Pylot现在被列在了我们的主页上,并使用了我们的一些基础设施(即论坛)。
然而,我最近也认为负载测试的整个概念是有缺陷的:在应用程序变得如此复杂的情况下,模拟HTTP流量是一件令人痛苦的事情。这就是我创建商业工具BrowserMob的原因。它是一个外部负载测试服务,在回放负载时使用Selenium来控制真实的web浏览器。
与正常的负载测试技术相比,这种方法显然需要更多的硬件,但在使用云计算时,硬件实际上相当便宜。这样做的一个很好的副作用是编写脚本比普通的负载测试容易得多。你不需要做任何高级的正则表达式匹配(就像JMeter要求的那样)来提取cookie、. net会话状态、Ajax请求参数等等。因为您使用的是真正的浏览器,所以它们只是做它们应该做的事情。
很抱歉公然推销一个商业产品,但希望这个概念对一些人来说是有趣的,至少让他们考虑一些新的方法来处理负载测试,当您有一堆额外的硬件时!