How Apache JMeter simulates multiple users?

Friday, March 26, 2010 by Tushar Joshi
Topics covered in this article:

  1. Introduction to different elements of a JMeter Test Plan.
  2. Difference between real world and JMeter world while doing a web request.
  3. Workflow of a typical web server request and response.
  4. JMeter's role in a web testing work flow.
Let us take a view at how a request for web page is sent to the Web server from a User's browser, and how a web page is finally displayed.  Understanding this workflow will give us opportunity to imagine how JMeter fits in this workflow and how it can do same thing as a browser does.


Now introducing Apache JMeter into the picture.  The actions taken by the User are no longer required.  The User action trigger some HTTP requests which are recorded in a JMeter HTTP Request Sampler for multiple uses.  

See how JMetr replaces a browser, but how the working is a little different.


So what makes one User transaction in terms of JMeter?  

When we add a HTTP Request Sampler in JMeter Test plan it stores one Web Page calling and receiving sequence.  We can call this as a single user transaction.  As soon as we tell this to JMeter it is capable of doing the same thing any number of times.  It also does this multiple times simultaneously.


As JMeter is not exactly a browser the HTTP Request Sampler makes all the received data available for further analysis.  We use View Tree Listener for actually visualizing the received response.  View Tree Listener is a good way to know what request was sent, what was the response and the result of the transaction.


When JMeter simulates multiple users by making the same call multiple times, in different operating system threads (we can say execution paths) that time more analytical data is available.  The Summary Report Listener can show us the additional calculated data line Minimum time and Maximum time taken to receive the response.  It also calculates the average time taken using all the results together.


So we have seen that for web site testing we need many items like
  1. HTTP Request Sampler
  2. View Tree Listener
  3. Summary Report Listener
To use these items provided by JMeter we will also need items like

  1. Test Plan and
  2. Thread Group
For some advanced user transactions and logical conditions there are Controllers.  Once we learn how to combine these elements we are ready to write our first Test Plan in JMeter.

Yes initially this may seem like a lot of jargon.  Eventually we will get used to these elements and then testing will be a piece of cake.  Ok, let us re-visit what they all mean in JMeter world.


We will write our first Test Plan step by step in the next article but let us first get introduced formally with the different elements we have seen till now.

Now we know some elements which will be used in creation of a Test Plan in JMeter.  It will be worthwhile checking the difference between real world transactions and the transactions that happen in JMeter world.  Is there one to one mapping between actions performed in real world and while executing a JMeter test plan?


Thats all for this article.  Thanks for reading.

with regards
JMeter-Expert Blog Team
Posted in | 40 Comments »

40 comments:

Unknown said...

Very good and easy to understand article. Thanks!

Anu said...

OMG article, But would be appreciated if posted further details...

Thanks!

Mohammed Sikander said...

Very nice article, helpful for beginners.

Tushar Joshi said...

Thanks for the appreciation, I believe you have read the next post in this blog which is technical with examples.

with regards
Tushar Joshi, Nagpur

Khamosh Nigahein said...

Mr. tushar a very laudable effort by yourside.
This is the best elucidation i saw while googling for help in J-meter.

You are a fantastic teacher.
Had i been in Nagpur i would have learned this from you.

sir, plzz do explain how to use jmeter for Performance Testing .

I hv read Jmeter documentation but still i am finding no way to set proxies work right in my office... ? do help


Thanks & Regards :
Azhar Rizvi , Bangalore.

ranga said...

hi tushar sir,what ever the information provided by you is in good understanding format,can you explain me the aggregate report like this manner,so that will be useful for me


thanks&Regards
Ranganath

vipul Agarwal said...

thanks tushar i really appreciate work done by u

Anonymous said...

Hello Sir,
I am just a fresher, i've already know much of the stuff abt jmeter...
Keep Up the good work

Best Regards
Nandan A
Bangalore.

Niraj said...

Awesome. Really excellent work Tushar.

GK said...

I am the beginer...
I am cleared in this topic.

SelvaKumar said...

I really, feel it was an great work. As a fresher in both testing and jmeter, i feel this article was wonderful, greatful, worthable, understandable article...

I expect more work from you... about jmeter

Suren said...

Excellent work, Tushar you know very well what the pain points for anyone who is new to jmeter are and have covered those with such ease. Great job, you seem to follow the same pattern as head first.

Keep up the good work.
Thanks,
-Surender

rohit yadav said...

excellent sir ...really very nice presentation !!!

Unknown said...

You are really THE BEST!
Thanks guys for your job!

Unknown said...

Great article, I like your style of explaining. Keep up this great work!

Unknown said...

Thanks for this article, it helps me a lot to understand the small things also in Jmeter. Dont stop posting article, thanks

Unknown said...

Very Good Article and very helpful to understand

Unknown said...

Hi Tushar,

Hope Your doing well,

I have many doubts about Result i am trying to find out result since 2 Months but i am not understood properly can you please help me Out for this .
My Question Is Below
1. How we know the exact Response time Of Each page
2. How many VUsers We can create in scrip
3. suppose We got Error in View Result Tree then what will be the Next step.
4. sometimes if i Put above 500 Users then My tool is Getting Hang Out what is the reason behind this.


please tell me as soon as possible .

any one reply is highly appreciated.

give me your contact Details for further discussion

Thanks,
Harshal
harshal@sweet60online.com

Unknown said...

Explained Very nicely

JindoSyrie said...

Good blog. Easy to understand.

Unknown said...

Very very useful, i hope this article will guide to who are new to JMeter. Keep it up.

Unknown said...

Kindly guide me about HTTPS request in Jmeter. Can Jmeter do that with any additional step, if yes then i would like to request you to write on it.

punit said...

Your blog is awesome. I need some more article.

Rahuljais said...

Excellent blog for starters.....really appreciate your work..

DilRox said...

HI Sir,
Excellent Stuff.As a beginner to jmeter this is the greatest article to looking to.....
Thousand times thanks for initiating this.

siva said...

Nice Article and easy understanding.

Rafiullah Hamedy said...

Wow, if this is how you explain stuff, I will go through every article in your blog. You make a great demonstrator. Thanks for the tutorial.

Lasitha said...

Nice article.....Thanks

Chandraprakash Sarathe said...

This is a nice article and easy to understand....I have one query, hopefully I can get answer.
Using thread group one can test multiple users but what if there is login based application and I want to login with unique user id and password for each web request.

Tushar Joshi said...

@Chandraprakash Sarathe

The scenerio you mentioned can be achieved by using a CSV file having username and password combinations. The thread group will use one row of that file each time it logs into the site. The sampler where we pass username and password will need variable placeholders to use this dynamic data. You can get help for this feature by a little search.

Quick answer to your question is yes, that is possible.

Unknown said...

D best visualize elucidation thanks

ranjan roy said...

Mind-blowing guide i never before like that. I have read your article single time and i am feeling expert about jmeter. Thanks sir.Please update we if any more knowledge if you have.

Unknown said...

Really Understandable. Simple easy to understand with comparison of real world scenario. Thank a lot that u make to learn more to increase my knowledge.

Small request i need your guide this is my mail id krtnavu@gmail.com, so give me your contact

Unknown said...

Very nice article and easy to understand but i have one query....how we can compare the results for different number of users and how to find peak load using jmeter?

Unknown said...

Fabulous.*****

Anonymous said...

it is really very easy to understand sir

reena said...

excellent article.
Layman explanation.

Unknown said...

Aweosme One

Binh Le said...

awesome article!

Unknown said...

nice article

Post a Comment