Stress/Load Test Ajax heavy Web Application
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 a开发者_JAVA技巧ll 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?
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.
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.
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.
I used WebLOAD for a similar type of test - it's correlation engine is very useful in heavy AJAX situations.
精彩评论