Reputation: 389
I'm using JMeter to test an Apache2 server I configured. I'd like to test whether the server can handle 200 HTTP requests coming altogether every second, repeatedly for a high number of seconds (like 1 minute, or even more). I read the JMeter documentation, but it struggled a little bit in understanding the Timers functioning. I configured the test with
- Numbers of Threads 200
- Ramp-up period 1
- Loop Count 100
Now, as far as I understood and noticed, the behavior of JMeter is to try to raise the 200 threads in 1 second, and then perform 200*100=20000 requests as fast as possible (or at least this is the behavior I'm experiencing on my server), in chunks of 200 requests per time. This means that the server might (it actually does) receive more than 200 requests/second. The behavior I'd like to reproduce is instead to have 200 requests exactly every second. I don't care if they are coming all together at the beginning of the second, or they come in a randomized way, distributed the second window (one every 5 milliseconds, or whatever). So I tried some Timers, but without success. I tried:
Constant Timer
with a Thread Delay of 5 milliseconds. Doing the math, it should send a request every 5 milliseconds, and being 200 Threads, it should send 200 requests/second (200*5 = 1000ms).Constant Throughput Timer
with a target throughput of 12000.0. Maybe I'm wrong here, but this should be samples per minute, so 200 requests per 60 seconds are 200*20 = 12000 (if a sample is a request). I did not understood the "Calculate Throughput based on" option, and I tried both "this thread only" (which one?) and "all active threads".Anyway, none of this configuration is acting as I need.
Upvotes: 1
Views: 11129
Reputation: 2978
You can achieve this by using Constant Throughput Timer.
Constant Throughput Timer can only pause the threads to reach specified "Target Throughput" value so make sure you provide enough virtual users (threads) to generate desired "requests per minute" value.
So, to get 200 requests/sec you have to consider below things:
Make sure that you have Enough number of virtual users (Threads) in your Thread Group.
Throughput Timer is quite accurate on "minute" level, you need to "wait" for it to start working as expected for 60 seconds. Make sure that you have Enough Durations.
Use the Constant Throughput Timer at the test plan level
.
Use "Calculate Throughput based on" value as "All active threads".
Also, Remember that other elements (for example, other timers, the number of specified threads, and so on) within the test plan can affect attaining the desired throughput.
So, Here is a technique that you can follow:
First, use the below configurations and observe the throughput results.
Numbers of Threads : 200
Ramp-up period : 60 seconds
Loop Count : Check "Forever".
Duration (seconds) : 360
If it's not as expected (lower than expected), then increase the Number of threads
gradually and observe the throughput results increased or not.
You have to increase the number of threads until you get your desired throughput.
By doing this, if you can't get your desired throughput (200 Request/sec) then your application can not serve more requests per second than 200.
Upvotes: 5