Avoid polling in worker - #4094
Open
jlearman wants to merge 2 commits into
Open
Conversation
Author
|
This is in Draft because
It's not Draft because I expect to add any changes, other than based on reviews & testing. It should reduce request/response latency and improve throughput and scalability. |
jlearman
force-pushed
the
avoid_worker_polling
branch
2 times, most recently
from
June 26, 2024 14:17
42e26a9 to
6265838
Compare
The polling architecture with 200 ms sleep in ProcessEventMessages() has two drawbacks: - it imposes a rate limit of 5 events per second for any input source - it imposes an average latency of 100 ms per event The polling loop can be avoided using a goroutine per worker that posts incoming events to the `messageStream` channel, and pending on that channel in ProcessEventMessages(). A short `messageStream` queue guarantees fairness: no worker's latest event will be postponed for more than the length of the channel. Signed-off-by: Jeff Learman <jjlearman@gmail.com>
jlearman
force-pushed
the
avoid_worker_polling
branch
from
June 26, 2024 15:42
6265838 to
d6fedda
Compare
jlearman
marked this pull request as ready for review
July 24, 2024 12:53
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.
Pull Request Template
Description
The polling architecture with 200 ms sleep in ProcessEventMessages() has two drawbacks:
The polling loop can be avoided using a goroutine per worker that posts incoming events to the
messageStreamchannel, and pending on that channel in ProcessEventMessages().A short
messageStreamqueue guarantees fairness: no worker's latest event will be postponed for more than the length of the channel.Type of change
How Has This Been Tested?
The same changes have been tested in another project.
Additional Context (Please include any Screenshots/gifs if relevant)
...
Checklist: