Overloaded database

  • Build
  • Level 1 of 41
  • Signal

Difficulty 1 of 5

Users send 2,000 requests/s. The database answers about 1,000 reads/s, so requests wait and fail. Most requests read the same data. Put a cache between the API and the database.

Play level

VPS · 2 vCPU · 8 GB16 USD/moSQLUsers2,000 req/sAPI server1 vCPU · 1 GBPostgres0.5 vCPU · 2 GB
VPS16 USD/moHTTP/2SQLUsers2,000 req/sAPI server1 vCPU · 1 GBPostgres0.5 vCPU · 2 GB
The board at the start of the level
Cache size and hit ratioDrag or use arrow keys to change the cache size

1,600 keys · hit 81% · mean 3.2 ms

Goals and limits

p99 latency
under 200 ms
Error rate
under 0.1%
Monthly cost
under 20 USD/mo
Parts you can add
Redis cache
Part limit
1
Hosts
2 vCPU · 8 GB
Traffic
2,000 req/s

Concepts

How players did

Player results load from the server.