Repository navigation
perf(quic): twins stop pooling per downstream connection, QUIC UDP offload on the inbound listener, and the ≤1.5× per-request gate for the flag drop (#1021) - #1034
Merged
Conversation
…fload on the inbound listener, and the ≤1.5× per-request gate for the flag drop (#1021) - proxy.QUICClusterFrom pins connection_pool_per_downstream_connection off on every twin (one identity per twin; the option only multiplies QUIC connections by app connections). //test/mtlspool TestQUICTwinUpstreamConnections: 12 downstream connections -> 1 QUIC connection (1 worker), 4 (4 workers), 12 (option forced on). - proxy.InboundQUICUDPListenerConfig: prefer_gro on the inbound QUIC listener (Envoy defaults it off for listeners); writer left to Envoy's automatic GSO selection. TestQUICRequestCPU (opt-in, AETHER_QUIC_COST=1): destination CPU per request -11 % dense / -9 % sparse; GSO writer variants within noise. - //test/envoy_validate: no quic: twin pools per downstream connection; the node bootstrap's QUIC inbound carries prefer_gro and no pinned writer (both seen red by flipping production). - Docs: 038 Phase 4b, runbook (per-request cost, connection-count expectation), e2e/soak/README.md gate (h3 <= 1.5x h2, baseline 3.3x / 2.88 fleet envoy cores). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
added a commit
that referenced
this pull request
Sep 28, 2026
Resolves the 038 Selection conflict with #1034 (#1021 per-request cost) by keeping both paragraphs: #1033's admission rule, then #1021's cost findings. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
added a commit
that referenced
this pull request
Sep 28, 2026
…ant-twin-pairs Keeps both sides: #1034's quic_cost_test.go and 038 per-request-cost paragraph alongside #1036's quic_dormant_test.go and dormant-pair paragraph. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
1. The fan-out: the per-downstream pool was already off. Workers and endpoints explain it.
The hypothesis in #1021 does not hold at
origin/main:connection_pool_per_downstream_connectioncame off the h2 base in #842, so a twin cloned from that base never carried it. At the pin (Envoy 726d7ac),ClusterManagerImpl::ThreadLocalClusterManagerImpl::ClusterEntry::httpConnPoolImplbuilds the pool hash from these inputs:transportSocketFactory().hashKey(...), which forQuicClientTransportSocketFactoryisCommonUpstreamTransportSocketFactory::hashKey: SNI override, SAN/ALPN overrides, and the hashable shared filter state, i.e. the source SPIFFE IDconnectionPoolPerDownstreamConnection()That hash is per worker (
ThreadLocalClusterManagerImpl) and per host. So a twin opens one QUIC connection per (worker the source's app connections landed on) per destination endpoint. It does not open one per app connection. This is the same shape as the h2 path, which is why #1006 also saw 128 h2 connections for svc-3/4. The fleet's ~64 connections per destination are Σ over source nodes of (dialling SAs × Envoy workers × endpoints). k6's 60 VUs per node spread their connections across every worker.Measured with
//test/mtlspoolTestQUICTwinUpstreamConnections: 12 keep-alive downstream connections from one source to one destination, 3 rounds each. Connections were counted at the destination (distinct QUIC connections) and in the twin'supstream_cx_total:Change:
proxy.QUICClusterFromnow pinsConnectionPoolPerDownstreamConnection = false. This way a future change to the base cannot turn every app connection into its own QUIC connection. Per-source isolation still holds because a twin carries exactly one identity. Two pods of the same ServiceAccount share a twin's connections, which is the mesh's identity model (identity = SA) and the partition the h2 pool key has used since #842. The QUIC selection tests (TestQUICSelectionPresentsEachSourceIdentityand the swapped-arms negative control) stay green, and so doese2e/eastwest-quic.shE2/E5 (each caller's own SPIFFE ID in XFCC).2. UDP GSO/GRO
What the pin supports:
udp_listener_config.downstream_socket_config.prefer_grodefaults to false for listener sockets (UdpListenerImpl). The QUIC listener already getsUdpGsoBatchWriterFactoryautomatically whensupportsUdpGso()is true (listener_impl.cc). An explicitenvoy.udp_packet_writer.gsoskips that kernel check.createConnectionSocket). The only client packet writer (envoy.quic.packet_writer.default) has no GSO, so nothing on the twin can be changed.Measured with
//test/mtlspoolTestQUICRequestCPU(new and opt-in:--test_env=AETHER_QUIC_COST=1). A source Envoy sends through the production twin to a destination Envoy whose QUIC listener carries the variant. CPU is/proc/<pid>/statutime+stime of both processes, loaded minus idle, reported as ms of CPU per request. 10,000 paced requests at 250 rps over 8 connections, 2 interleaved repetitions:A sparse run (2,000 requests at 25 rps on one upstream connection, with a 40 ms gap that outlasts the delayed-ACK timer) gave the same result: h2 1.012, h3 without GRO 1.950 (1.93×), h3 with GRO 1.857 (1.83×). Destination CPU went from 0.870 to 0.795 ms.
Result: GSO makes no measurable difference. The three writers are within 1.5 %, because a mesh RPC response is one or two packets. GRO on the listener cuts destination CPU per request by 11 % (dense) and 9 % (sparse), and total CPU by 5 %. Change:
proxy.InboundQUICUDPListenerConfig()setsprefer_gro: trueand leaves the writer unset, so Envoy keeps choosing GSO automatically.3. ACK / idle settings: reviewed, not changed
QuicProtocolOptionshas nomax_ack_delayor ack-frequency field, only QUICHE connection-option tags, and no measurement here supports picking one. The twin's HTTP idle timeout (30 s) already closes idle connections long before QUICHE's 600 sidle_network_timeout. The stream and connection windows limit buffering, not CPU.Http3ProtocolOptionsis unchanged.4. The gate
e2e/soak/README.mdgets "The QUIC per-request cost gate (#1021)". It records the #1006 method: matched 80-minute no-roll windows (T0+6h05m→T0+7h25m), per-destination rps matched to ~2 %, envoy-only Pyroscopeprocess_cpu, loaded minus idle, andper_h3 = per_h2 + Δenvoy / quic_rps. Acceptance for #979: h3 ≤ 1.5× h2. The baseline is 3.3×, 2.88 fleet envoy cores (rev242), against the rev239 h2 reference of 3.3 ms per request. It is also added to the Grading list. No load was run against talos-main.5.
//test/envoy_validateenvoy --mode validatewithprefer_gro.TestQUICUpstreamsDoNotPoolPerDownstreamConnection, over the fixture bytes plus an anti-vacuity flip.TestNodeBootstrapCarriesTheQUICInboundnow also assertsprefer_gro: trueand no pinned writer.= trueinQUICClusterFrom,PreferGro: false), both tests failed with the aether#1021 messages. Both are green again after restoring.6. Docs
docs/runbook.md: how to read h3 per-request cost, and the expected connection count per destination, which is SAs × workers × endpoints per source node, not app connections. It includes PromQL.Verification
bazel test //agent/... //test/...passes, 38/38.--config=race //agent/internal/xds/...passes.--config=lint --@aspect_rules_lint//lint:fail_on_violation //agent/... //test/...is clean.//:formatproduced no diff.e2e/eastwest-quic.shon kind passes E0–E5, with images built through the scratchpad output root andEWQ_SKIP_BUILD=1. The proxy log has noGRO requested but not supportedline. The kind cluster was deleted and the context restored totalos-main.What this does not close
On loopback the harness puts h3 at ~1.8× h2 after GRO, and production was 3.3×. GRO alone will not reach 1.5×, and the connection fan-out is the same as h2's (per worker × endpoint), so there is no cheap reduction left there. The ≤ 1.5× gate stays open. It needs a soak reading, and probably work beyond this PR, such as fewer, denser QUIC connections (per-worker pools are Envoy's design) or QUICHE ACK tuning backed by a profile. Hence:
Refs #1021
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr