Search code examples
algorithmdistributed-computingcluster-computingmaster-slave

Leader Election Algorithm


I am exploring various architectures in cluster computing. Some of the popular ones are:

  1. Master-Slave.
  2. RPC
  3. ...

In Master-slave, the normal way is to set one machine as master & a bunch of machines as slaves controlled by master. One particular algo here got me interested. It's called Leader-Election Algo which has a certain randomness in selecting which of the machines will become master.

My question is - Why would anyone want to elect a master machine this way? What advantages does this approach have compared to manually selecting a machine as master?


Solution

  • There are some advantages with this algorithms:

    1. Selection of node as leader will be done dynamically so for example you can select node with highest performance, and arrival of new nodes may be makes better choice.
    2. Another good approach by dynamically selecting leader is, if one of a nodes have major fault (for example PC is shutting down) you have other choices and there is no need to manually change the leader.

    3. if you manually select node should manually configure all other nodes to use this node, and also set their time manually, ... but this algorithms will help you to handle timing issues.

    4. for example (not very relevant) why in most cases using DHCP? too many configs will be handeled by this algorithms.