Scaling Real-Time: Building Federated Subscriptions in Rust
summary
Hive Router implements federated GraphQL subscriptions in Rust, supporting WebSockets, SSE, multipart HTTP and HTTP callbacks end-to-end; it uses synthetic HTTP requests to treat websocket operations as normal requests and a central broadcaster to deduplicate and fan out events so thousands of clients can share one upstream subscription. At scale the callback mode flips the model to avoid 120,000+ open streams (10k subs × 3 subgraphs × 4 routers). Rust yields predictable memory, cheap shared ownership, and the refactor to shared pointers makes long‑lived streams practical.
AI-written summary · about
chapters (20)
- 0:00Introduction and context
- 1:24Federated subscriptions explained
- 2:28Why federated subscriptions are hard
- 3:52Subscription protocol fragmentation
- 5:15Protocol translation in routers
- 6:41Keeping connections alive
- 7:01Entity resolution in subscriptions
- 8:25Subscription state management
- 8:47WebSocket handling challenges
- 9:52Synthetic HTTP request trick
- 11:19Header handling over WebSocket
- 12:43Token rotation benefits
- 13:06WebSocket for all operations
- 13:27HTTP callback protocol
- 14:52Callback protocol benefits
- 15:56Central broadcaster design
- 17:43Back pressure handling
- 18:47Rust benefits for subscriptions
- 20:12Key takeaways summary
- 21:19Q&A on horizontal scaling
related talks
34mGraphQL Subscriptions - Scaling real-time in the real world
34mGraphQL real-time subscriptions
15mGraphQL Subscriptions in Production Is Easy Isnt It?
58mStreaming Subscriptions in GraphQL
30mHow to Choose a GraphQL Gateway
07mThe future of GraphQL routing
30mBest Practices for GraphQL and GraphQL Subscriptions at Scale
35mBuilding Actor Systems in Rust
