System design / 13 simulations
Scaling Databases and Caches
Caches, load balancers, shards and replicas.
Open the lab → Change the load, break a part, watch what happens. Free, no sign-up.
All topics: scaling data
- Servers behind a load balancerBeginner · 7 min
Round robin vs least connections, health checks, crashes, traffic spikes and auto-scaling.
- A cache in front of a databaseBeginner · 6 min
Cache-aside with Redis: hit rate, TTL, cold starts and what happens to the database without it.
- Connection poolingIntermediate · 5 min
Borrow database connections instead of opening one per request. Size the pool, watch the queue, and hit the database limit.
- Cache eviction policiesIntermediate · 5 min
LRU, LFU, FIFO and Random race on the same traffic. Scans and shifting trends pick the winner.
- Sharding: splitting data across serversIntermediate · 8 min
Hash mod N vs consistent hashing, keys that move, and why virtual nodes even out the load.
- Replication and quorumsAdvanced · 8 min
Pick N, W and R. Watch stale reads appear and vanish, and what a failed replica does to availability.
- Leader election and Raft consensusAdvanced · 8 min
Crash the leader and watch a new one win by majority vote. Writes commit only when most servers have them.
- CAP theorem: a partition forces a choiceIntermediate · 6 min
Cut the link between two regions. CP refuses requests on the minority side; AP keeps answering and loses writes when the link heals.
- SQL vs NoSQL: same workload, two databasesBeginner · 5 min
Push load and change the share of joins and transactions. SQL hits its primary’s ceiling; NoSQL scales out but pays for joins and loses atomicity.
- Query optimization: reading an execution planIntermediate · 5 min
One query, three indexes. Watch a full table scan become an index seek that skips the sort and stops after 20 rows.
- Elasticsearch: how an inverted index finds thingsIntermediate · 5 min
Type a search over a product catalogue. See terms, stemming and posting lists find what SQL LIKE misses, while reading far less.
- Database deadlocks: two transfers, two rows, stuckAdvanced · 5 min
Transfers lock two account rows each. Watch a wait-for cycle form, the detector kill a victim, and lock ordering make deadlocks impossible.
- Database transactions: commit, rollback, and pulling the plugBeginner · 5 min
Crash the server mid-transfer. Without a transaction money vanishes; with one it rolls back. Then see why commits must reach the disk.