Performance Zone is brought to you in partnership with:

Dedicated and detail-oriented IT Engineer experienced in software deployment, cloud infrastructure, process automation, shell scripting and configuration management. Also skilled in Agile Development and Scrum. Always ready to work with new technologies and to deliver continuous improvement. Alen is a DZone MVB and is not an employee of DZone and has posted 6 posts at DZone. You can read more from them at their website. View Full User Profile

HTTP Load testing with JMeter

01.16.2013
| 21623 views |
  • submit to reddit


In previous post I wrote that for high availability load balancing with HAProxy and CARP on FreeBSD I used JMeter as a testing tool. In this post I will show some basics and how to use it for HTTP load testing. JMeter is an Java application that can be used to simulate a heavy load on a server to test its strength or to analyze overall performance under different load types. For full set of features please visit official site here.

One thing you should know as this tool is not a browser. That means JMeter does not perform all the actions supported by browsers and also it can’t run JavaScript or Flash. It is a desktop application that can be run on Windows or any other operating system. So please go here and download it first. After extracting if you are Windows user run “bin/jmeter.bat”. You will get bellow screen:

JMeter starting page

In this post I will describe how to setup most basic load test plan in JMeter. Basically with load testing you want to answer on two questions:
- Can your application support expected number of users?
- At what load does the application break?

So to get started first you need to add a thread group (users):

JMeter add thread group

Now go to thread group you added and define:
- Number of users
- Ramp-Up period (time between user group will hit the requests)
- Loop count (how many times to run this thread)

Next you need to add sampler (HTTP request) to this group:

JMeter adding sampler

Once you added HTTP request sampler you will see a lot of options. At the moment pay attention to those:
- Server Name or IP
- Path

When you define this, test is basically ready, but we need some reporting. In JMeter that component we call Listener. So go to test plan and add one listener:

JMeter adding sampler

Your results will be shown here with all request and response details. To run test do: Ctrl + R. You can follow status in real time if you go to View Results Tree. When it’s finished you can rerun it by Ctrl + E to clean old results and Ctrl + R to run it again. At the end you will get something like this:

JMeter resuls

As I said at beginning this is the most basic HTTP load testing plan, JMteter is far away from that and to be able to create more realistic test cases you will need to learn more advanced options that are available. I Highly recommend this tool for any kind of testing. Also the tool can be easily extended through custom plugins.

Set of JMeter extensions developed by AtlantBH currently includes:
- OAuth Sampler
- REST Sampler
- JMS Tools (Java Request Sampler)
- JSON to XML Converter
- XML Format Post-processor
- HDFS Operations Sampler
- HBase Scan Sampler
- HBase RowKey Sampler
- Hadoop Job Tracker Sampler
- HBase CRUD Sampler
- JSON utils (JSON Path Assertion, JSON Path Extractor, JSON Formatter)
Published at DZone with permission of Alen Komljen, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Kenneth Mark replied on Wed, 2013/01/16 - 10:57pm

Good tutorial !

Sree Chm replied on Wed, 2013/01/23 - 9:23am

Excellent 

Jeff Benton replied on Wed, 2013/01/23 - 9:47am

 The link to download jmeter is incorrect.  "http://www.bizdirusa.com/mirrors/apache//jmeter/binaries/apache-jmeter-2.8.ziphttp://"  it should be "http://www.bizdirusa.com/mirrors/apache//jmeter/binaries/apache-jmeter-2.8.zip"

Olivier Dupré replied on Wed, 2013/01/23 - 11:06am

Hummmm... I was expecting much more details and explanations.


I know pretty well JMeter, and this tool can do much more than what is slightly shown here. 

From my point of view this is more a brief paper on JMeter to let everyone knows that the tool exists, than a tutorial or an explanation on "how to do a load test with JMeter".


Where do you interpret results? How to use them? Understand them? How to really do a load test? I mean, not just with one page, recording a script with JMeter, using several different users (meaning several different sessions) to run the test, defining an accurate load test (you defined 2 different test cases, through 2 different questions : how do you address each? Depending on the app needs, what ramp up? What targets? etc...


Well, you understood, I'm a bit disappointed by this paper...

Yogs Figure replied on Wed, 2013/01/23 - 11:52am

This is nice. I had tried JMeter previously so this was kind of refresher.

Spotlight Saif replied on Sun, 2013/07/14 - 3:45pm

thanks for the comment, and sorry for any confusion. I think for the most part it makes sense to turn off comments in sponsored posts, unless the advertiser is willing to accept the risk. There should be no special rules for comments on vendor posts. My comments toward the end were more about the editorial filters the actual content should go through - but your point is valid. Hope that helps. buy instrumentals 

Teriharrington1... replied on Tue, 2013/10/15 - 1:21am

That is my first time i am going post. I collected so many attention-grabbing issues in your web site especially its discussion. From the tons of comments on your posts incentive spirometer measurements

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.