For write-heavy workloads, adding read replicas does not help, because with master-slave replication every write still goes to a single master. Multi-master replication lets more than one node accept writes, increasing write capacity and availability.

How it works

With multiple masters, inserts and updates can happen on a group of nodes, and there are multiple copies of the data. If one master fails, another can keep serving writes. The application doesn't need to route all traffic to one master, which simplifies traffic routing. The trade-off is complexity: the system must resolve conflicts when the same data is modified on multiple nodes.

Conflict resolution strategies

  1. Last Write Wins (LWW): the most recent write overwrites earlier ones. Simple, but determining the "last" write is hard when node clocks drift.
  2. Version vectors or vector clocks: each write carries a version or timestamp, and the higher one wins. This adds overhead for tracking versions.
  3. Application-level resolution: the application merges conflicting writes using business logic, or asks the user to decide.
  4. Distributed locking or transactions: only one node can write a piece of data at a time. This prevents conflicts but adds complexity and reduces performance.

Amazon Aurora

Amazon Aurora previously offered a multi-master option for its MySQL-compatible edition, with multiple read-write instances across Availability Zones. Availability of this feature has changed over time, so verify the current status in the AWS documentation before designing around it.

When to choose it

Pick multi-master when you need higher write capacity and write availability, and you are ready to handle conflict resolution. For very large datasets, compare it with sharding, which also scales writes.