Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate Concurrent User load in Jmeter

I have a test where users will logs in and enter search keyword in search field and will get the results. Finally logs out.

Now I want to test concurrency using Jmeter. So this is what I came up with.

Test plan
  Thread group
  + Login request
    + Synchronizing Controller
  + Search string 
    + Synchronizing Controller
  + Logout 

I have added 10 in number of threads. I have added 5 in Synchronizing Controller. So when I run the test I will get the concurrency of 5 users? Rest 5 users will be simultaneous users?

Also I have depended request when login page loads. So to achieve concurrency on login, I have added all the request in transaction controller and added Synchronizing Controller as child to transaction controller. Please let me know if I am doing it right.

Also please let me know if there is another way to achieve concurrency for specific action (ex: 5 users hitting login button at same time).

like image 281
user1169236 Avatar asked Apr 17 '12 11:04

user1169236


1 Answers

First off, you should try to distinguish between 'concurrent' and 'simultaneous'. They are normally very similar terms but in load testing they have different meanings. Simultaneous means two or more requests at the same time. Concurrent is two or more threads (scripts) running in parallel.

So, what you are talking about is trying to configure JMeter to simulate multiple simultaneous requests. But actually, there's a much, much better approach than this. Instead of focusing on trying to hit the same request at the same time, which is fiddly in JMeter, you should setup your test to be a realistic representation of the sort of load you want your application to support. If you do that well, using random wait times, throughput controllers and a realistic number of threads, then you will automatically be testing concurrency and at the same time running genuine, valid and useful performance tests too.

So, basically, drop the synchronising timer, use a constant throughput timer instead, configure wait times and then calculate the correct number of threads to generate the desired load.

The added bonus to this approach is you will be much less likely to raise false negatives. For example, if you hit your server with 5 simultaneous login requests then you might find that this call is single-threaded and the response times increase. But maybe this doesn't matter, maybe the chances of two login calls at the same time are so small that it is not worth spending time changing the code. This is a very, very important concept in load testing - perhaps the most important - you must have realistic objectives, without these you could be running tests, finding false bugs and generally wasting time forever.

like image 85
Oliver Lloyd Avatar answered Oct 21 '22 05:10

Oliver Lloyd