Join Ibrar Ahmed, Sr. Software Engineer, Percona, as he discusses the concept of multi-primary replication and elaborates on the well-known multi-master replication available.
Scalability can be achieved horizontally or vertically. Vertical scalability means adding more resources/hardware to existing nodes to enhance the capability of the database to store and process more data, for example, adding a new process, memory, or disk to an existing node.
Horizontal scalability means adding more nodes, therefore, horizontal scalability more challenging to implement. It requires more development effort and requires more work to set up. PostgreSQL provides quite a rich feature set for both vertical scalability and horizontal scalability. Replication is the crucial pillar of horizontal scalability, and PostgreSQL supports unidirectional master-slave replication, which is enough for many use-cases, but there is still need for Multi-Primary Replication. Multi-Primary replications mean there is more than one node that acts as master nodes. Data is replicated between nodes and updates and insertion can be possible on a group of master nodes. In that case, there are multiple copies of the data. The system is also responsible for resolving any conflicts that occur between concurrent changes. There are two main reasons to have a multiple primary replication; one is HA, and the second is performance.