v157 ยท webtransport draining

Load-balancer drain budget

When an HTTP/3 server emits DRAIN_WEBTRANSPORT_SESSION (0x78ae), the client still needs enough time to receive the capsule, dial a replacement session, and let its longest tail streams finish before the container orchestrator sends SIGKILL. Model your workload's p50/p95/p99 stream duration distribution against the server drain timeout below.

Workload & server drain deadline calculator

Choose a workload profile or adjust the p99 stream duration, replacement handshake RTT, and server drain deadline to compute stream survival and recommended Kubernetes / Envoy drain configuration.

Streams surviving drain 99.8%
Streams reset at deadline 1 stream
Min safe drain timeout 7.5 s
K8s terminationGracePeriodSeconds 13 s
Active stream decay curve versus server drain deadline 100% active streams (0x78ae sent at t=0) 0x2843 CLOSE deadline

code path

// Server + client coordination during rolling restart:
// 1. Orchestrator sends SIGTERM to pod (terminationGracePeriodSeconds: 15).
// 2. HTTP/3 server immediately writes DRAIN_WEBTRANSPORT_SESSION (0x78ae)
//    on every open WebTransport CONNECT stream.
// 3. Browser resolves wt.draining, dials replacement session within 1 RTT,
//    and stops opening new streams on the draining session.
wt.draining.then(async () => {
  const nextSession = new WebTransport(endpointUrl);
  await nextSession.ready;
  router.promoteSession(nextSession);
});

see also