Menu

Post image 1
Post image 2
1 / 2
0

I instrumented 95 DataLoaders in a production GraphQL API — here's what I found

DEV Community: graphql·Currently Buffering·3 days ago
#XPaRZAeL
Reading 0:00
15s threshold

DataLoader is the standard fix for GraphQL's N+1 query problem. Batch your database calls per request, cache within the request lifecycle, done. But once DataLoader is in production, you're flying blind. Which loaders are actually called per request? Is your cache hit rate 15% or 60%? Should your batch size be 10 or 50? APM tools tell you resolver latency, but they don't understand DataLoader batching. I built dataloader-ai to answer those questions. Then I tested it for real by instrumenting 95 DataLoader instances in Open Collective's GraphQL API . The problem: invisible batching Open Collective runs one of the largest open-source GraphQL APIs on the web. Their server/graphql/loaders/ directory contains 96 DataLoader instances across 20 files — loaders for collectives, expenses, transactions, members, comments, orders, and more. Without instrumentation, none of these questions are answerable: Which loaders fire per request? You can guess from the schema, but you don't know for sure without tracing.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More