distributed system - Leader election for paxos-based replicated key value store -
i going implement key value store multi paxos. have several nodes, 1 of primary node. primary node receive update requests , replicate values slave nodes.
my question how primary node (or leader) selected? can still use paxos algorithm? if so, think necessary abstract paxos implementation single unit used not replication unit leader election unit?
if use node least id leader? how can implement master lease?
thanks answers.
before actual question, suggest paxos-like system, don't think of master-slave relationship, rather equal-peer relationship. basic paxos doesn't have leader concept. multi-paxos tacks on leader performance optimization, electing leader part of protocol.
multi-paxos boils down paxos underneath: there prepare phase , accept phase. insight of multi-paxos once node wins accept round, has simultaneously won leader election , after prepare phase isn't necessary leader until detects node has taken on leadership.
and practical advise. have many years of experience working on several paxos, multi-paxos, , other consensus systems.
i first suggest not implementing either paxos or multi-paxos. optimizing paxos systems performance while keeping correct hard—especially if having these types of questions. instead look implementing raft protocol.
taking both protocols right off paper, raft protocol can have better throughput multi-paxos. raft authors (and others) suggest raft easier understand, , implement.
you may using 1 of open-source raft systems. don't have experience of them tell how easy maintain. have heard, though, of pain in maintaining zookeeper instances. (i have heard complaints zookeeper's correctness proof.)
next, has been proven every consensus protocol can loop forever. build system time-out mechanism, , randomized backoffs appropriate. how practical engineers around theoretical impossibilities.
finally, examine throughput needs. if throughput high enough, need figure out how partition across several consensus-clusters. , that's whole 'nother ball of wax.
Comments
Post a Comment