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 externally controlled executor not pausing #1479

Merged
merged 8 commits into from
Jun 9, 2020

Conversation

mstoykov
Copy link
Collaborator

No description provided.

@mstoykov mstoykov requested review from imiric and na-- May 29, 2020 14:53
@mstoykov mstoykov force-pushed the fixExternalExecutorNotPausing branch from 96ebd45 to 894ec1b Compare June 1, 2020 13:36
Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

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

I'll leave approval to @na--, but the AppVeyor timeout failure is a bit concerning. It implies that not all VLV VUs were returned, but not sure if it's a flaky failure or if it's introduced by these changes.

lib/executor/vu_handle.go Outdated Show resolved Hide resolved
lib/executor/variable_looping_vus.go Show resolved Hide resolved
@mstoykov mstoykov force-pushed the fixExternalExecutorNotPausing branch from 894ec1b to 23955c5 Compare June 2, 2020 14:27
@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2020

Codecov Report

Merging #1479 into new-schedulers will increase coverage by 0.03%.
The diff coverage is 89.53%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           new-schedulers    #1479      +/-   ##
==================================================
+ Coverage           76.76%   76.80%   +0.03%     
==================================================
  Files                 163      163              
  Lines               13008    13061      +53     
==================================================
+ Hits                 9986    10031      +45     
- Misses               2511     2517       +6     
- Partials              511      513       +2     
Impacted Files Coverage Δ
lib/executor/externally_controlled.go 61.32% <0.00%> (-1.00%) ⬇️
lib/executor/variable_looping_vus.go 94.09% <50.00%> (-0.38%) ⬇️
lib/executor/vu_handle.go 97.36% <96.00%> (+0.35%) ⬆️
lib/executor/helpers.go 94.50% <100.00%> (-2.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 830ebf6...02e96f6. Read the comment docs.

@mstoykov mstoykov force-pushed the fixExternalExecutorNotPausing branch from 0125210 to 7fabed9 Compare June 3, 2020 14:19
The problem was that pausing used gracefulStop which in turns wait for
the VU used by handle to be returned. The fix is to have another context
that is used for the actual runContext of the VU so we can cancel it
when we get gracefully stopped.

I tried to simplify (and speed up) the looping by only going through all
the channels and context stuff if there was a change, otherwise we use a
int32 and some atomic.LoadInt32 to see that "there is no change" and we
directly start a new iteration.

Additionally now the getVU error is propagetted by the vu handle's
start, which is probably badly handled in this commit.

Also the function that does the iteration now returns whether it was
interrupted mostly to help with faster interruption of the fast looping.
This might be reverted in a future commit, if the speed up isn't wanted.

Unfortunately in order to support returning the VU and not returning it
and still gettign the new VU but still to get start to actually return
the error from getVU it took way more code then was anticipated ...

The speed up is "insignficant" too, by my proffiling we were spending around
150-250ms (of 30s) in the mutex locking/channel reading now we spend 10ms(of
30s) in loading that int32. So 15-25x, but this is some sub percentage
time and this is for an empty bodied `default` function. More benchmarks
to come :D.
@mstoykov mstoykov force-pushed the fixExternalExecutorNotPausing branch from aeb022d to 99bfe04 Compare June 4, 2020 14:24
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

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

LGTM, or rather, I don't see any obvious issues, but the vuHandle code has gotten so complex that it's not obvious there aren't actually any issues... 😞

I like how the fast path is implemented, and I somewhat like that start() can return an error, if getting a VU fails. But my gut feeling is that either this can be simpler, or that we're doing something wrong if it can't be... In any case, I think simplification/refactoring this should be left as a low prio exercise for some future time, and we should use this version, unless we find a bug in it...

I'll create an refacotring low prio issue and reference this PR, with some ideas I had to maybe refactor/simplify the code, @mstoykov please chime in it if you have some of your own.

lib/executor/vu_handle.go Show resolved Hide resolved
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

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

#1492 is the new issue I mentioned above... Now, having written it, I'm even less certain we can simplify this code, but oh well... 😅 @mstoykov, please merge this, so I can include it in the renaming/refactoring PR I hope to publish tomorrow

@mstoykov mstoykov merged commit d932446 into new-schedulers Jun 9, 2020
@mstoykov mstoykov deleted the fixExternalExecutorNotPausing branch June 9, 2020 08:03
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.

None yet

4 participants