Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make request sending more time-accurate #88

Closed
sbordet opened this issue Jun 1, 2021 · 0 comments
Closed

Make request sending more time-accurate #88

sbordet opened this issue Jun 1, 2021 · 0 comments

Comments

@sbordet
Copy link
Member

sbordet commented Jun 1, 2021

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.

sbordet added a commit that referenced this issue Jun 4, 2021
Fixed send algorithm to improve ramp-up accuracy and sleep accuracy.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet closed this as completed in 220b1b7 Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant