jetty-project/jetty-load-generator

Make request sending more time-accurate

sbordet opened this issue · 0 comments

The current algorithm always sleeps for the rate period, not taking into account that sending requests takes a little time.

For example, for a rate of 10 requests/s, the timing are something like:

Action Time
0
start
sleep 100
105*
send
125
sleep 100
235*
send
250
sleep 100
355*
send
...

(*) sleeps may not be accurate.

Requests are sent at 105, 235 and 355, which is not very time-accurate, as they should happen at 100, 200 and 300.
Furthermore, over time the cost of sending and the oversleeps accumulate.

Instead, this is more time-accurate:

Action Time
0
start
sleep 100
105*
send
125
sleep 100 - 25
210*
send
225
sleep 100 - 25
305*
send
...

Requests are sent at 105, 210 and 305 which is more accurate with the nominal times of 100, 200 and 300.