Database Internals Lab: Interactive Simulations & Lessons
Storage engines, indexes, replication and partitioning. A hands-on database internals lab with 6 interactive simulations and 5 lessons.
Storage engines, indexes, replication and partitioning.
What happens between INSERT and the disk, why an index can make a query 1,000× faster and writes slower, how copies of data drift apart, and how data is split across machines.
Simulations
- B-Tree vs LSM-Tree — Insert keys into both engines side by side and watch page splits, memtable flushes, SSTables and compaction happen.
- Database Index — Query 10,000 ShopFlow orders with and without an index; count rows examined and see write costs rise.
- Leader/Follower Replication & Failover — Write to a leader, switch sync/async replication, kill the leader, and see what failover loses.
- Replication Lag: Read-Your-Writes — Update your profile, read from a lagging replica, and fix it with read-your-writes and monotonic-read strategies.
- Hash vs Range Partitioning & Hotspots — Distribute orders by range and by hash, then simulate a celebrity seller and watch a hot partition form.
- Consistent Hashing Ring — Place keys on a hash ring, add or remove servers, toggle virtual nodes, and compare key movement with modulo hashing.
Lessons
- Storage Engines: B-Trees vs LSM-Trees — Level 8 · Data Systems
- Indexes: Fast Reads, Slower Writes — Level 8 · Data Systems
- Replication: Leaders, Followers & Failover — Level 8 · Data Systems
- Replication Lag: When Your Own Write Disappears — Level 8 · Data Systems
- Partitioning: Hash, Range, Hotspots & Rebalancing — Level 8 · Data Systems
Also explore
- Build a Consistent Hash Ring — Build it yourself
Other labs
- Kafka Lab — Logs, partitions, keys, consumer groups and ordering.
- Transactions Lab — Isolation anomalies, lost updates and distributed transactions.
- Caching Lab — Hit rates, TTLs, invalidation, stampedes and CDNs.
- Microservices Lab — Failures, retries, circuit breakers, sagas and idempotency.
- Architecture Lab — Evolution, decisions, characteristics and fitness functions.