pause receiving while submitting tasks #534
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
results coming in during submission causes thread contention while submitting tasks, which can thrash performance with context switches
This pauses receiving messages while we are preparing tasks to be submitted, and resumes when they are done submitting. The result is the client focusing on task submission, delaying handling of results until it is done sending.
Need to do some testing, but prior to this PR, I could create a task pipeline that looks like this:
where a 'bubble' was created as the main task-creation thread paused while receiving the first bunch of tasks before submitting the next batch. This is hard to reproduce because it's thread contention with async network events, but I can at least compare overall execution time.
whereas a similar computation with this PR is denser:
I need to do some more tests and visualization to make better comparisons.
Also working on adding a notebook to the docs for visualizing an asyncresult's timestamps for profiling, etc. which is how I created these graphs.