-
Notifications
You must be signed in to change notification settings - Fork 3k
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 uneven distribution of locust classes between running locusts #860
Conversation
Codecov Report
@@ Coverage Diff @@
## master #860 +/- ##
==========================================
+ Coverage 66.55% 67.63% +1.08%
==========================================
Files 14 15 +1
Lines 1438 1480 +42
Branches 226 233 +7
==========================================
+ Hits 957 1001 +44
+ Misses 430 428 -2
Partials 51 51
Continue to review full report at Codecov.
|
@Umqra thanks for this -- I just identified the same problem with one of our suites and you've saved me a of debugging! |
@LukeCarrier Are there anything else that I should do to merge this pull request? |
@Umqra I'm just another Locust user I'm afraid -- I'm not knowledgeable enough about Locust's internals to give a quality review. Hopefully a maintainer will check in soon. |
I'm not sure about this one. I think the problem should be very uncommon in real world scenarios. To me it doesn't sound like you're doing a load test if you're affected by rounding errors in the number of spawned users. Still, the behaviour of this PR is better than the current behaviour, but I'm not sure it justifies the extra code and complexity. I wonder if it wouldn't be possible to instead add some extra logic to |
I took a stab at it in #1113. |
Closing this in favour of #1113 |
This PR fix bug related to the issue: #848
Bug description:
There was a function responsible for calculating the locust classes that will be spawned/killed after startup/changing of configuration. The algorithm for spawning
n
locusts work as following:p_i
for each locust class based on the class weightround(p_i * n)
Of course, this algorithm doesn't guarantee that exactly
n
locusts will be spawned because of rounding. This behavior can cause small, but annoying bugs (one such bug described in the related issue)Pull request description:
This pull request introduces simple and separate unit
LocustsCollection
, that is responsible for even distribution of locust classes between current running locust executors. This class implements a simple algorithm that maintains next invariant:Also, this PR includes small refactorings and little improvements in the
runners.py
file and tests.