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

fix: rampTo behaviour when arrivalRate is less than amount of workers #1621

Merged
merged 3 commits into from
Oct 20, 2022

Conversation

juanig1
Copy link
Contributor

@juanig1 juanig1 commented Oct 17, 2022

See #1589.
Setting an arrival rate lower than the workers being user to run the test, resulted in rampTo property being distributed across all workers alongside an incorrect value for arrivalRate

This generated an unexpected distribution of requests:
The root cause for this is that having a rampTo and no arrivalRate, defaulted to arrivalRate being 1.
Example:
using arrivalRate:1; rampTo:25 and running with 7 workers resulted in:

arrival rate distribution for each worker:

[
  1, 0, 0, 0, 0, 0, 0
]

rampTo distribution for each worker:

[
  4, 4, 4, 4, 3, 3, 3
]

When this got to the execution logic, arrival rate was being updated to 1 here causing the initial load to be higher than expected, so effective arrival rates were actually:

[
  1, 1, 1, 1, 1, 1, 1 // 0s -> 1s
]

After the update we remove 1 as default arrivalRate, avoiding the initial spike and still getting the most out of available threads.
Still worth mentioning that for smaller numbers setting WORKERS=1 may be desired to have a more controlled behavior.

@juanig1 juanig1 marked this pull request as ready for review October 18, 2022 08:35
@juanig1 juanig1 force-pushed the hotfix/rampup_distribution branch 3 times, most recently from b70aacc to c4d6af3 Compare October 19, 2022 13:02
Setting an arrival rate lower than the workers being user to run the test,
resulted in rampTo property being distributed across all workers instead
of the ones that had an actual arrivalRate.

As the default value for arrivalRate if not present was 1, it generated
a weird rampTo curve.

Changed the default to zero, in order to use all threads and keep the
expected ramp curve.
@juanig1 juanig1 changed the title fix: distribute rampTo only across active workers fix: rampTo behaviour when arrivalRate is less than amount of workers Oct 19, 2022
lib/dist.js Show resolved Hide resolved
Copy link
Member

@hassy hassy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor suggestions. LGTM otherwise!

test/core/unit/dist.test.js Outdated Show resolved Hide resolved
lib/dist.js Show resolved Hide resolved
juanig1 and others added 2 commits October 20, 2022 16:59
Co-authored-by: Hassy Veldstra <h@veldstra.org>
Co-authored-by: Hassy Veldstra <h@veldstra.org>
@hassy hassy merged commit cb50d60 into master Oct 20, 2022
@hassy hassy deleted the hotfix/rampup_distribution branch October 20, 2022 18:06
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

Successfully merging this pull request may close these issues.

2 participants