Database Replication, Sharding & Scaling
Explore database replication, sharding, and scaling with an interactive simulator. Compare sync vs async replication, shard key choices, hot spots, failover behavior, read replicas, write scaling, connection pooling, cost, and latency.
Category: Database
What You Will Learn
- Understand when replication helps reads and availability
- See why sharding is needed for write scaling
- Compare sync and async replication tradeoffs
- Explore shard key selection and hot spot behavior
- Balance database performance, reliability, and cost
Topics covered: database, replication, sharding, scaling, distributed-systems, postgresql, architecture, educational, interactive
// simulator
Database Replication, Sharding & Scaling
Explore database replication, sharding, and scaling with an interactive simulator. Compare sync vs async replication, shard key choices, hot spots, failover behavior, read replicas, write scaling, connection pooling, cost, and latency.
See how databases survive load, failure, and growth
Replication improves availability and read throughput. Sharding distributes data and write pressure. Scaling combines both with bigger nodes, pools, and cost tradeoffs.
Writes land on leaders, reads fan out to replicas, and lag appears when durability and latency pull in opposite directions.
higher throughput, possible stale reads
182 qps requested
failover and quorum effects
lower with stronger coordination
Lag is climbing. Move critical reads to the leader, lower write pressure, or increase consistency for safer reads.
Database replication, sharding, and scaling tradeoffs
Replication
- Read scale: replicas can serve read traffic, but writes still need coordination.
- Lag: async replication improves throughput but allows stale reads.
- Failover: losing a primary requires promotion, consensus, or quorum behavior.
Sharding
- Write scale: data is split across shards so multiple primaries can accept writes.
- Shard keys: uneven keys create hot spots and scatter/gather queries.
- Rebalancing: adding shards can move a lot of data if the partitioning strategy is poor.
Scaling
- Vertical scaling: simpler, but eventually hits hardware and cost limits.
- Read replicas: great for read-heavy workloads, weak for write-heavy workloads.
- Combined designs: replicated shards are common for large production systems.
Try next
// simulator
Database Indexing Simulator
Learn how database indexes work with an interactive simulator. See the difference between full table scans and index seeks, understand B-tree structure, and learn when to create indexes.
// simulator
Fork Bomb Simulator
Visualize how the infamous :(){ :|:& };: fork bomb works. Watch processes multiply exponentially, exhaust system resources, and learn how to protect against it with ulimit, cgroups, and systemd.
// simulator
AWS VPC Networking Simulator
Learn AWS networking fundamentals with an interactive VPC simulator. Visualize how traffic flows through public and private subnets, understand NAT Gateways, Internet Gateways, and route tables.