Lower Latency With Streaming GraphQL
summary
Shows how using @defer and @stream cuts perceived latency by returning non‑deferred fields immediately and delivering deferred fragments or list items incrementally with an initialCount strategy the demo uses to show two posts before the rest arrive. Describes a stable implementation in GraphQL.js with adapters for Relay and recent support in Apollo and Hot Chocolate, the wire format with pending/incremental/completed payloads, batching to reduce rerenders, server opt‑out, and error behavior when null bubbling prevents delivering a failed defer. Spec draft is under review.
AI-written summary · about
chapters (19)
- 0:00Introduction and background
- 1:02Problem with GraphQL latency
- 3:55Using defer directive in practice
- 4:58Streaming list fields with initial count
- 6:45Current status of defer and stream
- 8:11How defer and stream work behind the scenes
- 11:48Improvements in the latest protocol
- 13:56New response format and execution algorithm
- 16:22Batching deferred fragments for efficiency
- 17:24Server ignoring defer or stream directives
- 18:30Tracking multiple streams in a query
- 19:33Error handling in deferred and streamed fields
- 21:50Future of defer and stream in GraphQL
- 22:34Design decisions for defer and stream
- 25:43Streaming with pagination limitations
- 26:46Adopting defer in large federated schemas
- 28:31Server-side field deduplication rationale
- 29:54Defer and stream in federated GraphQL
- 31:17Q&A summary
related talks
35mState of @Defer and @Stream
21mStreaming HTTP and GraphQL
13m@Defer All the Slow Things
25mWhat's next for GraphQL?
12mHow @Defer and @Stream Will Improve GraphQL Caching
25mQuery Now, Render Later: Leveraging @defer for Efficient Data Delivery
12mImprove Application Performance and User Engagement with Advanced GraphQL Features
32mGraphQL Future
