压力/负载测试 Ajax 重型 Web 应用程序
我希望通过一遍又一遍地不断访问网址列表来模拟网络服务器上的重负载!
最初,我计划使用 wget/curl 编写一个简单的脚本,但由于该站点使用大量 ajax 请求来完成大部分繁重的工作,因此这不是一个可行的选择。这需要我编写一个复杂的脚本来解析链接中的 html、提取 ajax 请求、卷曲它们。我必须对每个请求递归地执行此操作。
理想情况下,有某种方法可以让浏览器(或类似的东西)在继续之前在每个链接上花费 15-30 秒来循环浏览 URL 列表!这意味着当每个 url 被访问时我的所有 javascript 都将被执行,并且站点加载将具有代表性
有人知道我如何轻松做到这一点吗?
I am looking to simulate heavy load on my web server by constantly visiting a list of urls over and over and over again!
Initially, I planned to write a simple script using wget/curl but because the site uses a lot of ajax requests for much of its heavy lifting, this isn't a feasible options. It would require me to write a complicated script to parse the html from the link, extract the ajax request, curl them. I would have to do this recursively for each request.
Ideally there is some way to get a broswer (or something similar) to just loop through a list of urls spending 15-30 seconds on each link before moving on! This would mean all my javascript will be executed when each url is visited and the sites load will be representative
Anyone know how i can do this easily?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看一下 LoadBooster(https://www.loadbooster.com)。它是一种基于云的负载测试服务,利用无头脚本浏览器 PhantomJS 来测试网站。免责声明:我在 LoadBooster 工作。
Take a look at LoadBooster(https://www.loadbooster.com). It is a cloud-based load testing service which utilizes headless scriptable browser PhantomJS to test web sites. Disclaimer: I work for LoadBooster.
您正在寻找的是“负载测试软件”。有很多解决方案 - 它们处理 AJAX 的能力差异很大。驱动真正的浏览器(通过 Selenium 等)的工具可能是最容易上手的 - 假设您的测试场景真的像“访问此 URL 列表”一样简单。至少有一个基于真实浏览器的 Web 测试工具可以为您执行此操作 (BrowserMob)。我们的产品 Web Performance Load Tester 模拟浏览器,但我们通常能够很好地处理 AJAX。 AFAIK,所有免费解决方案的功能都非常有限 - 特别是在涉及 AJAX 时。
What you're looking for is "load testing software". There are a lot of solutions - how well they handle AJAX varies greatly. A tool that drives a real browser (via something like Selenium) might be the easiest for you to get started with - assuming your test scenarios are really as simple as "visit this list of URLs". There is at least one real-browser web-based testing tool that can do this for you (BrowserMob). Our product, Web Performance Load Tester, simulates the browser but we are generally able to handle AJAX pretty well. AFAIK, all of the free solutions are pretty limited in what they can do - particularly when AJAX is involved.
使用阿帕奇工作台。
ab
像这样简单的事情:
> ab -k -n 100 -c 100 -g myresults.txt http://myajax.com/page
上面的意思是,100个页面超过100个并发连接,全部保持活动状态,并将结果保存到文本文件myresults.txt中。
http://www.google.co .uk/search?sourceid=chrome&ie=UTF-8&q=ab+apache
还有seige。
Use apache bench.
ab
Something simple like this:
> ab -k -n 100 -c 100 -g myresults.txt http://myajax.com/page
The above would mean, 100 pages over 100 concurrent connections, all with keep alive, and save the results to the text file myresults.txt.
http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=ab+apache
There is also seige.
我使用 WebLOAD 进行类似类型的测试 - 它的关联引擎在大量 AJAX 情况下非常有用。
I used WebLOAD for a similar type of test - it's correlation engine is very useful in heavy AJAX situations.