GraphQL The Devil's API
summary
Naive GraphQL resolvers cause massive DB round trips; a demo shows a simple three-model query going from ~1.05s to ~0.4s after batching, while a different traversal spikes to ~1.4s and fires hundreds of resolver calls. A Python stack using graphine+SQLAlchemy and Flask implements data-loaders that batch IDs into dense SQL queries via promise-style async, restoring acceptable latency and reducing hundreds of DB round trips to one. An open source tool Query Counter detects N+1s and the approach proves effective in the demos.
AI-written summary · about
chapters (22)
- 0:00Intro
- 1:18Outline
- 2:05What is GraphQL
- 4:00Query Language
- 7:15GraphQL Schema
- 8:59GraphQL Database
- 9:44SQL Alchemy
- 10:10GraphQL Libraries
- 10:47GraphQL Models
- 20:38Latency
- 21:33Python Code
- 21:56The Math
- 22:55Data Loader
- 23:36Data Loader Complexity
- 24:33Promises
- 26:08Dataloader
- 28:27Demo
- 32:28Bad GraphQL
- 34:03When to use GraphQL
- 35:18Query Counter
- 35:51Shoutouts
- 36:52Meetups
related talks
26mEvolving GraphQL: Designing APIs That Deliver Insights with Intelligent Resolv…
43mGraphQL in the wild
38mNew HotN+1ness -Hard lessons migrating from REST to GraphQL
25mGrafast: A Declarative Solution To GraphQL's Execution Woes
27mGraphQL on Rails
26mBuild a performance-optimized GraphQL API
31mGraphQL: how to make clients enjoy using your API
26mWhen GraphQL Gets Expensive: Performance & Cost Patterns in Production Serverless Architectures
