Skip to content

perf: do not propagate config extension options that have their default value - #902

Open
gabotechs wants to merge 2 commits into
mainfrom
gabrielmusat/dont-sent-default-in-headers
Open

gabotechs wants to merge 2 commits into
mainfrom
gabrielmusat/dont-sent-default-in-headers

Conversation

@gabotechs

@gabotechs gabotechs commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Every task the coordinator sends to a worker carries all the session's config extensions as gRPC headers, one header per option, even when the option was never changed. With just DistributedConfig that is 19 headers (~1.4 KB) per task, and a user extension with a few dozen options easily brings it to tens of KB. That is paid on every task dispatch, and past hyper's default 16 KiB HTTP/2 header list limit the worker rejects the task altogether with an opaque GoAway COMPRESSION_ERROR.

Workers already rebuild each extension starting from its Default implementation before applying the headers, so an option that still has its default value tells them nothing new. This PR remembers the defaults of every extension registered for propagation and only sends the options that differ from them.

before                                   after
coordinator ──── task ────▶ worker       coordinator ──── task ────▶ worker
  headers:                                 headers:
    distributed.broadcast_joins=true         distributed.broadcast_joins=false   (changed)
    distributed.compression=lz4
    distributed.collect_metrics=true       worker: T::default() + headers
    ... every option, every task           = same config as the coordinator

One behavioral nuance: if a worker's session builder pre-populates a user extension with non-default values before calling with_distributed_option_extension_from_headers, a coordinator option explicitly set back to its default no longer overrides the worker's value.

It also adds a config_propagation bench: 32 localhost workers running a 128-task query that returns one row per task, with a user extension holding 32 string options of 4 KiB plus integer, float, boolean and long-named options (~138 KB of headers per task when everything is sent). To let main send all of that, the localhost test workers now raise the HTTP/2 header list limit to 1 MiB.

scenario config headers per task (main → this PR) main this PR
defaults 115 / 138 KB → 1 / 81 B 11.45 ms 8.04 ms (−31%)
few_overrides 115 / 138 KB → 21 / 17.7 KB 11.66 ms 8.40 ms (−27%)
all_overrides 115 / 138 KB → 97 / 136.7 KB 11.45 ms 11.36 ms (no change)

all_overrides sends practically the same headers as main, showing that comparing against the defaults costs nothing measurable.

Workers rebuild config extensions from their Default implementation, so
options left at their default do not need to travel in the headers of
every task. Adds a config_propagation benchmark.
Raise the localhost workers' HTTP/2 header list limit so the bench can
send ~140 KB of config headers per task, and add an all_overrides
scenario.
@gabotechs
gabotechs marked this pull request as ready for review November 19, 2026 17:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant