Software Architecture – Meaning of ‘Master-Slave’ in Databases and Distributed Systems

Architecturedatabase

From Software Architecture and Design Illuminated

In the master-slave architecture, slaves provide replicated
services to the master, and the master selects a particular result among slaves by certain selection strategies. The slaves may
perform the same functional task by different algorithms and methods or by a
totally different functionality.

Master-slave architecture is used for the software system
where reliability is
critical. This is due to the replication (redundancy) of servers.

It should be noted that in database schema design, the terms master-slave or
parent-child are employed to specify the dependency of one entity on another
. If
the master node is deleted then the slave node has reason to stay.
This concept
does not apply to the discussion here.

Is it correct that there are two or more different meanings of the term "master-slave" or "master-worker"?

  1. Why does the concept of "master-slave" in "in database schema
    design" "does not apply to the discussion" in software architecture?
  2. In database schema design, what do the following mean:

    • "the dependency of one entity on another"

    • "If the master node is deleted then the slave node has reason to stay"?

  3. In the software architecture of master-slave, "if
    the master node is deleted then the slave node has reason to stay",
    does the slave node has no reason to stay?
  4. Also in distributed systems with data replications, is the concept of
    "leader and follower" the same as "master and slave" in
    software architecture?

    From https://en.wikipedia.org/wiki/Master/slave_(technology)

    In database replication, the master database is regarded as the authoritative source, and the slave databases are synchronized to it.

Thanks.

Best Answer

The "master/slave" concept usually relates to clustering. In services that need to scale outwards, or provide a fail-over concept the terms have general meaning.

I have never heard of database tables or schemas being referred to as master/slave. I have only ever heard them referred to as parent/child. In databases, an "Entity" is the logical representation of a Table, so the whole master/slave concept does not make sense at all. I recommend you take the reference material's advice: "This concept does not apply to the discussion here." In fact, if that paragraph were removed the concept would be much clearer.

At the most general abstract level, "masters" control and "slaves" work. The nature of how that controller/worker relationship plays out is slightly different depending on the type of application. With that oversimplified definition, you can understand why master/slave goes by new names these days.

In Replication

With replication, the concept is that the "master" node is considered "live" until some event happens when the master is no longer up. At that time the "slave" node becomes the "master". The architecture exists to preserve the availability of your data.

Master: The live instance of a database or file system that allows both reads and writes.

Slave: The reserve instance that only accepts writes from the master. In some cases, the slave is read-only to all other clients so reads can be load balanced.

Examples include SQL Server clustering, Windows Distributed File System

In Scale-Out Clusters

With scale out clusters, the data is spread throughout all of the "slave" nodes which helps scale out. The "master" nodes coordinate a number of aspects to ensure the health of the cluster. They have a summary view of what nodes have capacity, or even how the data is distributed across the "slaves". In the event that a "slave" node is lost, the "master" nodes coordinate redistributing data that used to live on that slave. Similarly, they redistribute data when a new "slave" node is introduced to the cluster.

Master: The server node or nodes that monitor the health of the slave nodes and coordinate work.

Slave: The server nodes that hold data and perform data updates and retrieval.

Examples include Elastic Search clusters, Kubernetes clusters

Related Topic