ref(server): Run processor threads with lower priority #4222
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.
The original plan was to also set the scheduler priority to
SCHED_BATCH
(man sched(7)
) but while looking for other projects I found Apache Arrow Fusion which also sets their priority for a CPU bound worker pool: https://github.com/msathis/arrow-datafusion/blob/bb646802001ffbb1cc35679eea0ded86dd769a8d/ballista/rust/executor/src/cpu_bound_executor.rs#L58-L59As well as a referenced blog article: https://thenewstack.io/using-rustlangs-async-tokio-runtime-for-cpu-bound-tasks/
Convincing me that this is in fact a good idea as well as dropping the idea of messing with scheduler priorities, which in testing also seems to be very finicky to get right.
The change is supposed to have a positive effect on tail latencies for all tasks scheduled on the Tokio runtime as well as prioritizing these tasks when under pressure.