Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing with JMeter: how to run N requests per second

I need to test if our system can perform N requests per second. Technically, it's 2 requests to one API, 2 requests to another, and 6 requests to third one. But the important thing that they should happen simultaneously - so 10 requests per second. So, in JMeter I've created three Thread Groups, first defines number of threads 1, and ramp-up time 0. Second thread group is the same, and third thread group defines number of threads 6 and ramp-up time 0. But that doesn't really guarantee it's going to run them per second How do I emulate that? And how do I see the results -- if it was able to perform or wasn't?

Thanks!

like image 753
alexeypro Avatar asked Feb 16 '11 16:02

alexeypro


People also ask

How does JMeter calculate requests per second?

when you have one thread (user) sending requests to server and server responds after 100ms, you have 1 thread * 1000ms / 100ms = 10 transactions per second. when you have 10 threads sending requests to server and server responds after 100ms, you have 10 threads * 1000ms / 100ms = 100 transactions per second.

How do I control hits per second in JMeter?

If you want to simulate specific throughput values you will need to use special timers called Constant Throughput Timer or Throughput Shaping Timer. Constant Throughput Timer is available out of the box with JMeter. Throughput Shaping Timer is a plugin and you need to install the plugin.

How does JMeter increase hits per second?

Use "SetUp Thread Group". You can calculate thread number and rump up time to get Threads per Second desired.


1 Answers

You could use ConstantThroughputTimer.

Quote from JMeter help files below:

18.6.4 Constant Throughput Timer This timer introduces variable pauses, calculated to keep the total throughput (in terms of samples per minute) as close as possible to a give figure. Of course the throughput will be lower if the server is not capable of handling it, or if other timers or time-consuming test elements prevent it. N.B. although the Timer is called the Constant Throughput timer, the throughput value does not need to be constant. It can be defined in terms of a variable or function call, and the value can be changed during a test.

For example I've used it to generate 40 requests per second:

 <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="Constant Throughput Timer" enabled="true">       <stringProp name="calcMode">all active threads in current thread group</stringProp>       <doubleProp>         <name>throughput</name>         <value>2400.0</value>         <savedValue>0.0</savedValue>       </doubleProp>     </ConstantThroughputTimer> 

And thats a summary:

Created the tree successfully using performance/search-performance.jmx Starting the test @ Tue Mar 15 16:28:39 CET 2011 (1300202919244) Waiting for possible shutdown message on port 4445 Generate Summary Results +  3247 in  80,3s =   40,4/s Avg:    18 Min:     0 Max:  1328 Err:   108 (3,33%) Generate Summary Results +  7199 in 180,0s =   40,0/s Avg:    15 Min:     1 Max:  2071 Err:   378 (5,25%) Generate Summary Results = 10446 in 260,3s =   40,1/s Avg:    16 Min:     0 Max:  2071 Err:   486 (4,65%) Generate Summary Results +  7200 in 180,0s =   40,0/s Avg:    14 Min:     0 Max:   152 Err:   399 (5,54%) Generate Summary Results = 17646 in 440,4s =   40,1/s Avg:    15 Min:     0 Max:  2071 Err:   885 (5,02%) Generate Summary Results +  7199 in 180,0s =   40,0/s Avg:    14 Min:     0 Max:  1797 Err:   436 (6,06%) Generate Summary Results = 24845 in 620,4s =   40,0/s Avg:    15 Min:     0 Max:  2071 Err:  1321 (5,32%) 

But I run this test inside my network.

like image 77
lb_lb Avatar answered Sep 27 '22 21:09

lb_lb