0

I want to ensure consistency between 3 servers. It's a consensus problem. Each server listens to the users and saves the collected data in a local file. I tried to use Rpc to send the new data to all the others servers but in vain. Also I want to use the algorithm paxos to ensure the consistency. I just want to know if the solution that I made is the optimized one or I can use socket instead or an other algorithm rather than paxos like raft.

I wish you understand my problem. Thanks in advance :)

1 Answers1

0

First thing you should decide what does it mean: every server listens for user requests. What happens next? Do these servers immediately apply those requests locally, or they send them to a leader?

In the first case - each node applies changes locally and them sends them to other nodes - this is a multi-leader replication. As you could guess, it is challenging to agree on values, as it is possible that two different request change the same data on different. There are few options here, to make the system eventually consistent, but that's probably not what you want.

Now we get to consensus. In a big picture, paxos/raft/etc are all single leader replication systems. One of nodes will be elected as leader and every other node eventually will get the same sequence of events - that will be the consensus part.

I recommend to check raft instead of paxos - there are many libs for either, but I find raft to be a bit easier to work with.

AndrewR
  • 1,252
  • 8
  • 7
  • Thanks for the answer.. It's the first case each node have to apply changes in the file locally then communicate with the other nodes so that we have at the end the same data in all files. – wa-minarosita May 05 '22 at 15:51
  • So if I understand you well, I have to elect a leader each time i will have multiple leaders. then I don't know exactly how can I send a data to another file or I can simply replicate the file. – wa-minarosita May 05 '22 at 15:54
  • "simply replicate" - that's not that simple :) - how will you handle conflicts? paxos/reaft based consensus solves this problem by processing all changes through the same node; as a result, there is no conflict - when there are multiple nodes, one of those becomes the leader (in raft terms). – AndrewR May 05 '22 at 17:56
  • in multileader replication, you will end-up with the same data as well, e.g. via gossip, assuming you have a way to resolve conflicts in some deterministic way, e.g. Last Write Wins – AndrewR May 05 '22 at 17:57
  • in multileader replication i think i will use leader election several time.. and then assuring consistency using gossip for example.. The question now is how can I send data to other nodes (nodes in my case are ubuntu servers machine ) smthing like that : https://www.youtube.com/watch?v=9D_nhKnH3bY&t=108s&ab_channel=YerhardLalangui. Can we talk via email or smthing I want to know additional informations. – wa-minarosita May 05 '22 at 21:21
  • Leader and multileader are mutually exclusive options. Use raft (raft.github.io) has plenty of libraries to use. You will have to send all request to the leader - and raft will copy correct, conflict-free data to all nodes. – AndrewR May 06 '22 at 01:05
  • Thank for your time and ur help ^^ – wa-minarosita May 06 '22 at 01:16