Skip to content

The egress gateway limits kernel send queues to slow destinations - #3322

Closed
Chuang Wang (chuangw6) wants to merge 1 commit into
agent-substrate:mainfrom
chuangw6:sockmem-egress
Closed

Chuang Wang (chuangw6) wants to merge 1 commit into
agent-substrate:mainfrom
chuangw6:sockmem-egress

Conversation

@chuangw6

@chuangw6 Chuang Wang (chuangw6) commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #3133; design and data in docs/network-socket-memory.md (#3319).

The egress gateway sets TCP_NOTSENT_LOWAT to 16 KiB on its egress listener (sockets from atunnel) and on its four forward proxy clusters (sockets to destinations). Without it, an upload to a slow destination can put the tunnel's 1 MiB HTTP/2 window into the socket's send queue. A test checks the listener and every forward proxy cluster keep it. To turn it off, delete those blocks.

Envoy benchmark, destination stops reading, one tunnel, median of 3 Off Lowat 16 KiB
socket KiB 1420 48

Download speed at +10 ms is unchanged (309 vs 308 MB/s). Fixed 64 KiB buffers cut it to 10 MB/s, so they are left out.

  • Tests pass
  • Docs updated

@chuangw6
Chuang Wang (chuangw6) force-pushed the sockmem-egress branch 2 times, most recently from 3fb4075 to 1dca129 Compare October 27, 2026 17:17
An upload to a destination that reads slowly can put the tunnel's 1 MiB
HTTP/2 stream window into the send queue of the gateway's socket to the
destination, charged to the gateway's container. Set TCP_NOTSENT_LOWAT to
16 KiB on the egress listener and on the four dynamic forward proxy
clusters, so the backlog stays behind Envoy's buffer limit and the
tunnel's flow control. In the Envoy benchmark a stalled tunnel alone on
its connection dropped from 1420 to 48 KiB of socket memory, with
throughput within run-to-run noise.

Fixed buffer sizes are left out: a fixed SO_RCVBUF cut a tunnel's
throughput by 90% at 10 ms round trip.

Signed-off-by: Chuang Wang <chuangw@google.com>
@bowei Bowei Du (bowei) added area/network kind/feature An enhancement / feature request or implementation labels Oct 27, 2026
@chuangw6

Copy link
Copy Markdown
Collaborator Author

Merged into #3320.

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

Labels

area/network kind/feature An enhancement / feature request or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants