The Magic of Dataloader with GraphQL
summary
GraphQL fronts multiple PayPal microservices but field-level resolvers cause duplicate REST calls, so GraphQL + DataLoader is used to batch requests and cache results in a single execution frame. A tiny JS DataLoader is built from scratch using process.nextTick and promise microtasks to collect keys, call one batch function, and return cached promises; the demo reduces four identical fetches to three network calls and returns cached values. Notes: cache invalidation is manual via clear and clustered apps need explicit strategy.
AI-written summary · about
chapters (10)
- 0:00Introduction to disputes
- 2:06Problem with microservices
- 3:35GraphQL as solution
- 7:50GraphQL performance issue
- 9:16Introducing DataLoader
- 10:20Batching requests demo
- 15:59How DataLoader works
- 17:20Node.js event loop basics
- 19:51Recreating DataLoader
- 27:20Q&A session
related talks
26mBuild a performance-optimized GraphQL API
38mDataloader 3.0: An Alternative Algorithm to Solve N+1 Problems
39mGraphQL Accelerated
27mGraphQL: Towards a universal query language
21mStreaming HTTP and GraphQL
27mGraphQL on Rails
29mFrom REST to GraphQL
37mGraphQL and Microservices or How we learned to be big and small at the same time
