Master/Slave Architecture

MasterSlave

In software architecture, Master/Slave defines a type of architecture in which we have one master node and several slave nodes, with the master exerting total control over the slave nodes. Also, the direction of communication in this architecture is always from Master to Slave (However, this may not apply in failure conditions).

The master node could control the following factors (this list is just a sample):

Challenges:

  1. Being Fault tolerant:

Let us imagine a scenario in which; the master node fails (refer above diagram). It would have a catastrophic impact on the system, since all the slaves are dependent on the master node for directions.

In such a scenario, we can have an arrangement wherein, when the master node fails, one of the slaves would take over as master without impacting the system. For example, in the above diagram, when the master node crashes, Node 3 is elevated as Master node.

How is the slave node chosen?

To effectively implement the above fail over strategy, the slave node should be aware of the state of the master before it went down. i.e., it should periodically synchronize the master’s state with itself. The time period of synchronization would depend on the use case and the criticality of the system being built.

Reference Implementations:

Databases like MySQL could be configured in a Master- Slave setup. The master node could be read-write node whereas the slave nodes could provide read only operations.