Batched execution
Resolve related GraphQL field work in batches by default, so list-heavy queries do not degrade into per-item backend calls.
Applies to
- GraphQL servers
- Execution engines and runtimes
- Gateways that execute resolvers
Why this should be default
N+1 is one of the most common sources of GraphQL performance failure. Batched execution makes the safe behavior the easiest behavior.
Solves
Implementing solutions
- Batch resolvers
- TODO: Planning (e.g. Grafast)
Batching and caching (DataLoader), when used consistently, can also be used to solve this problem. However, it is not included as part of the golden path because it requires users to opt-in to its usage in each position rather than making it the default experience. If not used consistently, it can result in small batch sizes and related poor performance.