Why a cache saves your database

Live simulationFailing

Scroll the diagram to see every component at a readable size.

no cacheUsers1,500 req/sAPI Server×31,500 req/scapacity 3,000 req/sDatabase×21,500 req/sreads 1,000 · writes 1,000 req/s
p99 latency
2,281ms
Errors
28.3%
Cost
$551/mo

The database's 1 read replica can serve 1,000 reads/s but is receiving 1,425. 28% of requests fail. A cache in front of it would absorb most of those reads.

Real simulator engine, not an animation.Edit in the playgroundOpen on System Design Sim