Draft
Conversation
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.
Linear
STREAM-820
Description
Currently, taskworkers pull tasks from taskbrokers via RPC. This approach works, but has some drawbacks. Therefore, we want taskbrokers to push tasks to taskworkers instead. Read this page on Notion for more information.
This PR allows users to run the taskbroker in push mode. It introduces seven new configuration parameters...
TASKBROKER_PUSH_MODEboolfalseTASKBROKER_FETCH_THREADSusize1TASKBROKER_PUSH_THREADSusize1TASKBROKER_PUSH_QUEUE_SIZEusize1TASKBROKER_WORKER_ENDPOINTStringhttp://127.0.0.1:50052TASKBROKER_CALLBACK_ADDRString0.0.0.0TASKBROKER_CALLBACK_PORTusize50051Push Threads
On startup, the taskbroker now creates a "push pool," which is a pool of push threads. All of them wait to receive activations from the same MPMC channel provided by the
flumecrate. When a push thread receives an activation, it sends it to the worker service. Note that each push thread has its own connection to the worker service.Push threads are grouped together by the
PushPooldata structure, which exposes astartmethod to actually spawn the threads and asubmitmethod to receive activations.Fetch Threads
On startup, the taskbroker also creates a "fetch pool," which is a pool of fetch threads. Each one retrieves a pending activation from the store, passes it to the push pool (waiting until it accepts), and repeats.
Notes on Naming
Fetch threads and push threads are actually asynchronous tasks provided by the Tokio crate. They are not real threads.
Details
Dependencies
flume0.12.0 as a dependency (I didn't want to add any dependencies, but Tokio does not provide an asynchronous MPMC queue - only MPSC)sentry-protosfrom 0.4.11 to 0.8.5 (to use the new worker service schema)tonic,tonic-health,prost, andprost-typesto 0.14 (to match the version used bysentry-protos)Additions
FetchPoolabstraction insrc/fetch.rsPushPoolabstraction insrc/push.rssrc/main.rsModifications
get_taskwhen operating in push modeFuture Changes