Database Replication

Databases

Also known as: master-slave replication, leader-follower replication, read replicas

Database replication is the process of copying and maintaining database objects across multiple servers, providing redundancy for fault tolerance and enabling read scaling by distributing queries across replicas.

Replication ensures that if one database server fails, another has an identical copy of the data and can take over. The most common setup is leader-follower (master-slave) replication: writes go to the leader, which streams changes to followers. Reads can be served by any replica.

Replication modes differ in consistency guarantees: synchronous replication waits for all replicas to confirm before acknowledging a write (strong consistency but higher latency), while asynchronous replication acknowledges immediately and streams changes in the background (lower latency but potential data loss on leader failure).

Multi-leader replication allows writes at multiple nodes, useful for geographically distributed systems but introduces write conflict resolution complexity.

In system design interviews, replication is fundamental for achieving high availability and read scalability. Key trade-offs involve the CAP theorem — you often must choose between consistency and availability during network partitions.

Related Terms

Ready to design?

Practice using database replication in a real system design on Supaboard's interactive whiteboard.

Browse Challenges