Voting

多个server的选举策略

difference between cs:

  • other do not need to know who enter cs. election need other know who is coordinator.
  • fault tolerance is primary consideration in election.

bully algorithm

  • what: use highest number as coordinator.
  • why: easy
  • how: when coordinator dies, send election to high number, if not recieve ack, it become coo and send to others.
  • problem: assumption is not realible(network is ok and we could know who dies accurately). failure need detect accurately.

invitation algorithm

  • what: form group to elect one and create a large one.
  • why: communication failure and high latency. use partition to handle is the best way.
  • how: merge them partition into group. choose one in partition and merge with another and get one.
  • problem: state is not consistence among group.

ring election

  • what:非同步算法。find cooridator die, send election around ring, every one add itself in the message. assume highest is new and everyone get message again remove itself.
  • why: good at high contention, and less messge

Children
  1. Paxos
  2. Raft