You might be wondering whether you still need backups if you have replication. The answer is yes, because they have different purposes: replicas quickly reflect writes from one…
- 07.01Backups and ReplicationYou might be wondering whether you still need backups if you have replication. The answer is yes, because they have different purposes: replicas quickly reflect writes from one…
- 07.02Single-Leader ReplicationEach node that stores a copy of the database is called a replica. With multiple replicas, a question inevitably arises: how do we ensure that all the data ends up on all the…
- 07.03Synchronous Versus Asynchronous ReplicationAn important detail of a replicated system is whether the replication happens synchronously or asynchronously. (In relational databases, this is often a configurable option;…
- 07.04Setting Up New FollowersFrom time to time, you need to set up new followers—perhaps to increase the number of replicas or to replace failed nodes. How do you ensure that the new follower has an…
- 07.05Handling Node OutagesAny node in the system can go down, perhaps unexpectedly because of a fault, but also because of planned maintenance (e.g., rebooting a machine to install a kernel security…
- 07.06Implementation of Replication LogsHow does leader-based replication work under the hood? Several replication methods are used in practice. Let’s look at each one briefly.
- 07.07Problems with Replication LagBeing able to tolerate node failures is just one reason for wanting replication. As mentioned in “Distributed Versus Single-Node Systems”, other reasons include scalability…
- 07.08Reading your own writesMany applications let the user submit some data and then view what they have submitted. This might be a record in a customer database, or a comment on a discussion thread, or…
- 07.09Monotonic readsOur second example of an anomaly that can occur when reading from asynchronous followers is that it’s possible for a user to see things moving backward in time.
- 07.10Consistent prefix readsOur third example of replication lag anomalies concerns violation of causality. Imagine the following short dialog between Mr. Poons and Mrs. Cake:
- 07.11Solutions for Replication LagWhen working with an eventually consistent system, it is worth thinking about how the application behaves if the replication lag increases to several minutes or even hours. If…
- 07.12Multi-Leader ReplicationSo far in this topic we have considered only replication architectures using a single leader. Although that is a common approach, there are interesting alternatives.
- 07.13Geographically Distributed OperationIt rarely makes sense to use a multi-leader setup within a single region, because the benefits rarely outweigh the added complexity. However, in some situations this…
- 07.14Sync Engines and Local-First SoftwareMulti-leader replication is also appropriate if you have an application that needs to continue to work while it is disconnected from the internet. For example, consider the…
- 07.15Dealing with Conflicting WritesThe biggest problem with multi-leader replication—both in a geo-distributed server-side database and a local-first sync engine on end-user devices—is that concurrent writes on…
- 07.16Leaderless ReplicationThe replication approaches we have discussed so far in this topic—single-leader and multi-leader replication—are based on the idea that a client sends a write request to one…
- 07.17Writing to the Database When a Node Is DownImagine you have a database with three replicas, and one of the replicas is currently unavailable—perhaps it is being rebooted to install a system update. In a single-leader…
- 07.18Single-Leader Versus Leaderless Replication PerformanceA replication system based on a single leader can provide strong consistency guarantees that are difficult or impossible to achieve in a leaderless system. However, as we saw…
- 07.19Multi-Region OperationWe previously discussed cross-region replication as a use case for multi-leader replication (see “Multi-Leader Replication”). Leaderless replication is also suitable for…
- 07.20Detecting Concurrent WritesAs with multi-leader replication, leaderless databases allow concurrent writes to the same key, resulting in conflicts that need to be resolved. Such conflicts might be…
- 07.21Recap: ReplicationIn this topic we looked at the issue of replication. Replication can serve several purposes: