McKracken
McKracken

Reputation: 389

Sending HTTP Request at precise time intervals with JMeter

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:

Anyway, none of this configuration is acting as I need.

Upvotes: 1

Views: 11129

Answers (1)

Masud Jahan
Masud Jahan

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:

  1. Make sure that you have Enough number of virtual users (Threads) in your Thread Group.

  2. 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.

  3. Use the Constant Throughput Timer at the test plan level.

  4. 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

Related Questions