-
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
Wrong distribution of virtual users by user classes #2662
Comments
Thats very strange and a significant issue. Is it consistently 22/23? |
The result is always reproduced with the same input data. The bug is consistently, not floating. I've done some tests, here's the result:
|
When the VU ratio TestUser1/TestUser2 = 0.8, the distribution doesn't work correctly. It feels like the algorithm is trying to equate virtual users of two user classes (only if it's 4/5). |
Interesting (that’s one word for it, right? ;) I’ll have a look at it once I’m back from holiday. @mboutet I dont know if you’re still around and have time to take a look :) |
Sent the PR. I think one of the problems was in the rounding algorithm, it rounded to an even number ("round half to even" or "banker's rounding"). For weights Lines 369 to 381 in a214363
Pseudocode: for As I noted above, that's why the VU values tended to be the same (because the normalized weights are the same). I reworked the algorithm using the greatest common divisor, because I think it's more logical in this case during normalization. Instead of |
Prerequisites
Description
Hi, thanks for the awesome project. I came across the behavior of locust that is unclear to me.
When I create two user classes
TestUser1
andTestUser2
with weights of 20 and 25 respectively, the actual distribution shows that 23 and 22 virtual users were created respectively. The sum of 45 is identical, but it is the distribution, I consider, that is being performed incorrectly. I think there should be 20 VUsers forTestUser1
and 25 forTestUser2
.Documentation says:
Locust logs:
Command line
locust --host http://localhost:5000 --users 45 --spawn-rate 50 --loglevel "DEBUG"
Locustfile contents
Python version
3.11.6
Locust version
2.24.1
Operating system
MacOS 13.6.4
The text was updated successfully, but these errors were encountered: