Member-only story
Database Replication: Benefits and Trade-Offs
Design better systems by understanding the trade-offs and benefits of database replication

Benefits
Database replication is a database scale-out approach where the same data is replicated to multiple machines. That sounds wasteful, but it is not without justifiable benefits: High availability and performance improvement.
High availability is achieved by having nodes with identical data. If one of the nodes fails, the system will still work because there are other nodes available. High availability is usually the primary reason one wants to do replication. Availability directly translates to the business’s bottom line. Nobody can do business with a business that is not available.

The system’s performance is improved by load balancing. Instead of having one node handling all the traffic, the system has multiple nodes handling a fraction of the traffic. The performance improvements manifest in lower latency, higher throughput, or both.

In addition to financial costs, replication has complexity costs. Before diving into that, let us first understand the two kinds of replication topology: Primary-Secondary and Primary-Primary. Different topology entails different complexity.

Primary-Secondary topology allows reads from any node while limiting writes to a designated node. In contrast, Primary-Primary topology allows reads and writes to be performed in any node.
Consistency: Strong or Eventual?
The first complexity is the trade-off between consistency and latency. A strongly consistent system generally has higher latency than an eventually consistent system. Strong consistency guarantees…