Everyone test’s their web sites before going live (right??), even if it just means that you click on the site after pushing it to production, but how do you simulate the large user count your production environment may see? Apache’s Jakarta Project has a product called JMeter that fits this bill nicely, though getting it working can be intimidating. This post will walk you through setting up a basic web site test and where to configure the important bits with the latest JMeter release.
First, of course, you need to go download the latest JMeter binary release:
http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi
On OS X you will need the binary file that ends in .tgz, on Windows grab the binary that ends in .zip. You will also need a JRE setup on your system (to test if you do, drop to a command / terminal prompt, and enter ‘java -version’. If you get ‘bad command or file name’, go hit Sun’s site and download the appropriate JVM / JRE)
Unzip the file to any folder on your system, then navigate into the ‘/bin’ folder, and on OS X you will see a ‘jmeter’ terminal-like icon, and windows has a jmeter.bat file. Fire those up, and after thinking for a bit you should see a window like the following:
First, lets add an HTTP test. Right click on ‘Test Plan’, and add a ‘Thread Group’. This thread group defines how many threads (each thread represents a simultaneous user), and how many times you want your tests to be run. Setup your thread group something like this:
Next, right click on your new thread group, and choose ‘ HTTP Request HTTPClient’. This will add a simulated client request to our test plan. You can have many different client requests setup at once, and your threads will happily click through them as if they are users browsing your site. Then setup the HTTP Request HTTPClient options as illustrated below:
I will add 1 more sampler here, simulating a user searching for ‘Alagad’ on google. Add a request parameter by clicking the add under ‘Send parameters with the request’, enter the name ‘q’, and the value ‘alagad’. The path here will be ‘/search’, and the server name or IP will still be http://www.google.com
Now we are almost done, but how do we view the results of our test? If we started this running, it would happily send requests to google (please don’t overdo, I don’t want to tick them off with jmeter tests). Right click on your ‘Testing Google’ thread group, choose add, choose listener, and finally choose ‘Aggregate Report’. There are many different listeners here, but this one will give you a simple summary of the number of request made, how many if any had errors, and some average times for responses. Now go to the ‘Run’ main menu, and choose ‘Start’ at the top. If you have your ‘Aggregate Report’ node selected while it starts running, you will see that it gets populated with data right away. Play around with some of the other listeners, you can write results data to files, you can inspect the response on every single request (or only error requests, I recommend doing only errors), and you can even see general graphed metrics.
For fun, try testing your site without trusted cache, then with trusted cache. As you increase the thread count of your jmeter test, trusted cache makes a larger and larger difference. Happy testing!
Comments on: "Site Testing with Apache's Jakarta JMeter" (16)
Chris, this is a great post, during my time at Allaire and then Macromedia we used Segue Silk Performer as the tool of choice, very expensive and slow to get scripts created. We settled on a tool from a German company called Paessler, the tool is called “Web Server Stress Tool” and it does all we ever need and we can have a script ready very quickly and the reports are great too.
LikeLike
Chris, thanks for posting this. I’ve used JMeter several times to whip up a quick stress tool, what a nice tool to have in the old arsenal. Would you be interested in a follow up post explaining the proxy server portion of JMeter so that it can record your clicks?(I love this feature!) If so, just let me know, I’d be happy to help.
LikeLike
Has anyone ever found a tool that replays web logs from an IIS or Apache server? I have worked with JMeter and Grinder, but did not find this type of feature in either. So have rolled my own in the past.
LikeLike
Take also look at http://www.webloadtester.com – affordable load testing service. It is quite simple but can help to generate instantly unlimited load on your web server.
LikeLike
It will be very useful to talk about proxy, from my point of view at the beginning is the most important thing to know about JMeter, knowing how to activate and use the proxy server avoid us a lot of misunderstands and work.
LikeLike
does this ACTUALLY put load on the server? for example if I set the number of threads to 100 and looped 10 times, will this actually load the server with 100 users?
It could be my ignorance, but I tried some on one of my production sites and while the test was running, the site itself was unresponsive, or gave a ton of mysql errors
LikeLike
Matthew,
Absolutely, this is fully simulating hordes of users frantically clicking away at your web site, so as far as your server (and any associated databases or networks) are concerned, this is real traffic. I like to start off slow with 5 concurrent users or so and ramp it up gradually, if I am working on a production system, to get to the target load we need to simulate.
Chris
LikeLike
Chris,
Thanks for the tutorial. I am having a problem where I need jMeter to go through a proxy and connect to the internet to run the test plan. Parts of the test plan need to access yui and those parts are failing as I cannot configure jMeter to go through a proxy. I have tried running the command line options (-H proxyhost -P proxyport -u username -a password) but no luck. Also, I would like to know what paramaters can i add to jmeter.bat so that jMeter GUi is configured to go through a proxy as well.
It will be great if you could help me out here.
Thanks,
Manav
LikeLike
Hello Chris,
I just started using jmeter for some testing and this blog is helping me a lot.
I have 2 questions.
#1 Can we use jmeter for testing javascript pixels? basically, if a javasript pixel is calling anotehr one and that is calling anotehr etc, Can jmeter be used to get the total result?
#2 How much load can I simulate maximum? I am assuming this depends on my machine(or not?). When I was using http_load, I had to use different servers to get the enough load for my load testing. If this is the case, is there a way in jmeter to specify that “I want to run this test at this particular time” ?
LikeLike
Use fast and free Anonymous proxy service with high Security.
LikeLike
hello
the screenshots are not shown currently
could you, please, re-upload them?
LikeLike
sasddsfdsfasdad
LikeLike
I enjoyed reading & I must say that I was very impressed with your writing skills. Keep up the good work it’s very refreshing to see someone like you 🙂
LikeLike
sorry to ask this what does ramp up time do and why do we need it and also how can i tell the response time for 50 users is slow in some site using throughputm avergae etc
LikeLike
“There is no sincerer love than the love of food.”- George Bernard Shaw (1856-1950)
LikeLike
Jmeter is great tool, but its reporting out-of-box capabilities are not very good. This issue can be solved using one of the following ways:
– using google-code plugins for jmeter;
– using jmeter plugin, which provides interactive reporting tool in performance testing cloud.
LikeLike