~18 KB/socket ≈ 4.5 GB heap per node with zero-copy broadcast channels and bounded per-client ring buffers.
Scale 250K+ concurrent GraphQL subscriptions across federated subgraphs using stateless HTTP Callbacks, router-side 1:N multiplexing, Kafka/NATS event bridges, and conflating backpressure rings.
~18 KB/socket ≈ 4.5 GB heap per node with zero-copy broadcast channels and bounded per-client ring buffers.
Collapses identical (opHash, varsHash) watchers into 1 upstream stream and 1 shared _entities enrichment call.
Kafka/NATS event dispatch + micro-coalesced Shipping._entities join + multiplexed WebSocket frame push.
Subgraph pods drain and roll freely without severing long-lived client WebSockets held at the Router tier.
| Layer / Role | Production Standard | Operational Responsibility |
|---|---|---|
| Federated Subscription Router | Apollo Router (Rust) / Cosmo Router |
Terminates 250K+ client sockets, deduplicates identical streams (1:N), and runs entity enrichment. |
| Client Transport Protocol | graphql-transport-ws (WS) / GraphQL-over-SSE |
Bidirectional WebSockets for high-frequency streams or HTTP/2 SSE for firewall-friendly unidirectional push. |
| Router ↔ Subgraph Protocol | Apollo HTTP Callback Protocol (Stateless) |
Replaces fragile upstream WebSockets with stateless HTTP POST callbacks surviving rolling pod restarts. |
| Event Backbone | Apache Kafka / NATS JetStream |
Decouples mutation writers from subscription publishers with durable partitioned event streams. |
| Cursor Replay & Presence | Redis Streams / Valkey |
Buffers recent event IDs so reconnecting mobile clients resume cleanly without missing state transitions. |
| Realtime Telemetry | OpenTelemetry Metrics + Prometheus WS Gauges |
Tracks active socket count, upstream mux ratio, ring conflations, and per-pod heap headroom. |
Subgraphs stay stateless—Kubernetes rolling deploys drain pods cleanly with 0% client WS drops and standard HTTP load balancing.
Slightly lower framing overhead per tick, but every subgraph pod restart snaps thousands of stateful pipes and triggers reconnect storms.
Multiplexes over existing HTTP/2 connections, passes corporate proxies effortlessly, and natively supports Last-Event-ID resume.
Full-duplex framing ideal for interactive collaborative sessions and multiplexing many subscriptions on one TCP socket.
graphql-transport-ws when clients multiplex 10+ live subscriptions.
Router calls Shipping._entities once per (orderId, eventVersion) and fans the enriched JSON out to all 50,000 watchers.
Simple to implement without muxing, but 50,000 watchers on a viral order trigger 50,000 redundant _entities calls per tick.
Overwrites stale intermediate GPS/price ticks for stalled mobile sockets, capping Router heap at ≤ 6.0 GB with zero OOM kills.
Required for chat messages or ledger deltas, but must enforce a hard max-queue limit and disconnect slow consumers to resume via Redis Streams.