-
Notifications
You must be signed in to change notification settings - Fork 1.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
Refactor ramping VUs executor #2155
Conversation
0dfb4c7
to
58d14cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice job with the test as well. It's very time dependent so hopefully it's not flaky, but there's not much we can do about that right now.
Thanks! I actually automatically ran the test 1000 times to make sure that it's not flaky. |
58d14cd
to
ef7063a
Compare
ef7063a
to
2f80991
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, the code is much neater ❤️ There are a few issues though, I've noted them and potential improvement suggestions inline.
Thanks, @na-- 😍 I’ll fix these today. |
2ce9b73
to
5157a36
Compare
5157a36
to
2350dda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All seems fine overall, just small suggestions mostly.
RampingVUs.Run method was complex and this refactors it by adding rampingVUsRunState to share run state between functions used by the Run method. + Makes the Run method easier to read and understand + Makes it explicit which Goroutines are being fired in the Run + Separates responsibilities to other parts like: + rampingVUsRunState and its methods. + Moves trackProgress Goroutine from the makeProgressFn to the Run method + Makes initializeVUs to only handle initializing GRs + Uses two strategy functions to make them reusable and clearer. handleVUs and handleRemainingVUs use them. + Makes the handleVUs algorithm easier to understand and manage.
This test aims to check whether the ramping VU executor interrupts hanging/remaining VUs after the graceful rampdown period finishes. handleRemainingVUs method should be interrupting the VUs that are beyond their allowed time budgets. See the comments in the test for more information.
This commit uses longer variables names to help understand code.
handleVUs and handleRemainingVUs was not sharing the current number of planned VUs in graceful steps. This may cause the latter method to act strangely. It's because handleRemainingVUs needs to know the number of remaining graceful steps so that it can stop the remaining VUs accordinly. Now the handleVUs method returns the number of handled graceful steps. So the handleRemainingVUs method can use this information and hard stop the remaining VUs.
2350dda
to
a9b039f
Compare
+ Also changes the value receiver type to a pointer receiver for rampingVUsRunState.
95fb52d
to
4bb561d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ramping-vus are structured much better now 😄 Great job, Inanc! ⭐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome! ❤️
At last, thanks! 😅 |
RampingVUs.Run
method is complex and this PR aims to refactor it.Improvements:
Run
method easier to read and understand.Run
method.rampingVUsRunState
and its methods.trackProgress
Goroutine from themakeProgressFn
to theRun
method.populateVUHandles
to only handle initializing VU handles (not firing up a GR)handleVUs
andhandleRemainingVUs
use them).handleVUs
algorithm easier to understand and manage.handleRemainingVUs
test with explanations to make newcomers' and new contributors' job easierNote: The other PR (#2124) is convoluted and somehow creates problems locally and with Github. I'd like to keep working on it on this separate branch.