N+1 at the gateway

  • Fix
  • Wire 22

Difficulty 3 of 5

Each GraphQL query resolves 50 records through separate calls. The API receives 200 queries/s. Fix the resolver with at most three edits. Keep p99 below 180 ms.

0:00. Gateway p99 is above 180 ms. Graph: catalog calls run at 50 per query, and catalog CPU is at its limit.

Play level

HTTP/2Users200 req/sApp backend1 vCPU · 1 GBAPI server1 vCPU · 1 GB
GraphQLHTTP/2Users200 req/sApp backend1 vCPU · 1 GBAPI server1 vCPU · 1 GB
The board at the start of the level
A page waits for its slowest callDrag or use arrow keys to change the calls per page

Calls per page: 20 · 18% of pages wait 2.0 s

Goals and limits

p99 latency
under 180 ms
Error rate
under 0.1%
Monthly cost
under 100 USD/mo
Parts you can add
App backend
Part limit
16
Edit limit
3
Traffic
200 req/s

Concepts

How players did

Player results load from the server.