Repository navigation
perf: disable Nagle's algorithm on scheduler connections - #2798
Merged
Merged
Conversation
The scheduler serves gRPC through axum, which, unlike tonic's own server, leaves Nagle's algorithm on for accepted connections. A poll response is several small HTTP/2 frames, so the later ones wait for the executor's delayed ACK: about 40 ms per poll on Linux. Under pull scheduling that is added to every task launch, so a stage of N waves pays N x 40 ms; TPC-H q2 at 128 partitions spent about 2 s of its 5.6 s waiting. Set TCP_NODELAY on every accepted connection. The standalone scheduler serves tonic from a pre-bound listener, which ignores the builder's tcp_nodelay, so set it there too.
andygrove
force-pushed
the
perf-scheduler-tcp-nodelay
branch
from
November 7, 2026 17:07
cf8c136 to
aeadcff
Compare
andygrove
marked this pull request as ready for review
November 7, 2026 17:20
milenkovicm
approved these changes
Nov 7, 2026
milenkovicm
left a comment
Contributor
There was a problem hiding this comment.
Looks like you're starting with infrastructure tuning. Thanks @andygrove
Member
Author
|
Thanks for the review @milenkovicm |
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.
Which issue does this PR close?
No single issue. Split out of #2792. Related: #2520 (performance review tracking).
Rationale for this change
The scheduler serves gRPC through axum, which, unlike tonic's own server, leaves Nagle's algorithm on for accepted connections. A poll response is several small HTTP/2 frames, so the later ones wait for the executor's delayed ACK, about 40 ms per poll on Linux. Under pull scheduling that is added to every task launch, so a stage of N waves pays N x 40 ms. TPC-H q2 at 128 partitions spent about 2 s of its 5.6 s waiting. At 128 partitions on one machine (TPC-H SF100), all of #2792 takes 148 s against 204 s on
main, mostly from this change.What changes are included in this PR?
TCP_NODELAYis set on every connection the scheduler accepts, viaListenerExt::tap_io. A failure to set it logs a warning and the connection proceeds. The standalone scheduler serves tonic from a pre-bound listener, which ignores the builder'stcp_nodelay, so it getsTcpIncoming::with_nodelay(true), as the standalone executor already does.No test: the effect is a socket option on accepted connections, and a test needs a real TCP socket.
Not covered: the scheduler's axum listener also sets no TCP keepalive, unlike the listeners made by
create_grpc_server_incoming. That predates this change.Are there any user-facing changes?
No config or API changes. Lower task-launch latency under pull scheduling.