Switch to long running tasks for the multiplexer#344
Draft
bdraco wants to merge 132 commits intoNabuCasa:mainfrom
Draft
Switch to long running tasks for the multiplexer#344bdraco wants to merge 132 commits intoNabuCasa:mainfrom
bdraco wants to merge 132 commits intoNabuCasa:mainfrom
Conversation
Collaborator
Author
|
We could probably have a single low res TimerHandle that resets on each loop and has a 10s leeway to re-arm. So we ensure we cancel both read/write tasks within timeout+10s. That we we aren't churning timer handles EDIT: with the task overhead gone, that is where all the time gets spent |
Collaborator
Author
|
That test fails locally before and after this change so I think its intent is to overload the queue but its too fast now, and my local machine is too fast as well before the change. The queue size needs to be patched to be smaller so it can be overrun before it can be processed |
Collaborator
Author
|
Maybe a RangedTimeout that does a callback on timeout |
Previously it only waited for the multiplexer to close but the task would still be finishing up. This became obvious after the assertion hit in NabuCasa#340
… to run too many times
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Performance improvements:
RangedTimeoutreduced the number of created TimerHandles by ~94% while accessing the UI by~2x performance improvement for small packets (common case) https://codspeed.io/NabuCasa/snitun/branches/bdraco%3Along_running_tasks
Some considerations
While these changes are designed for the client side, this combination of these changes is expected significantly increase the number of active connections a serve can handle at one time.
Instead of creating many small tasks, create two long running ones for the reader/writer to avoid flooding the event loop with tasks when the connection is generating many packets.
This is still a bit of a WIP, but should be deferred until after a release with #303 so they get separate release cycles
implement back pressure Implement pause and resume requests for a channel #353
download multi gig file
Known issues