cocagne / multi-paxos-example Goto Github PK
View Code? Open in Web Editor NEWExample multi-paxos application for those learning Paxos & multi-paxos
License: MIT License
Example multi-paxos application for those learning Paxos & multi-paxos
License: MIT License
first, where a value is judged to confirm in your code?
and, if one of the servers certain a value is confirmed, how the other servers know? By the listener? Could you tell me where is it in you code?
Thx!
Tom,
Hi!
I have configed multi-paxos-example in my computer windows7 64bit.
# (IP,UDP Port Number)
peers = dict( A=('127.0.0.1',1234),
B=('127.0.0.1',1235),
C=('127.0.0.1',1236) )
# State files for crash recovery. Windows users will need to modify
# these.
state_files = dict( A='E:\\multi-paxos-example\\tmp\\A.json',
B='E:\\multi-paxos-example\\tmp\\B.json',
C='E:\\multi-paxos-example\\tmp\\C.json' )
And try to run it. But when I run a client
python client.py B eee
It comes up a Error.
Error processing packet: accept {"instance_number": 0, "proposal_id": [1, "B"],
"proposal_value": "eee"}
Traceback (most recent call last):
File "E:\multi-paxos-example\messenger.py", line 55, in datagramReceived
handler(from_uid, **kwargs)
File "E:\multi-paxos-example\resolution_strategy.py", line 82, in receive_acce
pt
super(ExponentialBackoffResolutionStrategyMixin,self).receive_accept(from_ui
d, instance_number, proposal_id, proposal_value)
File "E:\multi-paxos-example\replicated_value.py", line 176, in receive_accept
proposal_id, proposal_value)
File "E:\multi-paxos-example\replicated_value.py", line 72, in save_state
os.rename(tmp, self.state_file)
WindowsError: [Error 183]
I google it and it means file existed, but I don't know how to solve it. Can you help me about that?
Thanks!
Jin
I've noticed that a consequence of using the paxos chain to manage the master lease is that we end up with mixed application level and election level data in the log.
If we were to add a new parameter to def advance_instance
in replicated_value.py
so that the caller can specify if the value should be persisted to the log or not. And we'd keep track of the paxos instance number separately, so having it not matching the file length is not an issue. Do you see any disadvantage with this approach?
Is there any use case in where it'd be useful to read the election result from the log?
As far as I can tell the sync_strategy seems to synchronize the node with the current state of the multi-paxos chain, but doesn't get up to date about previous resolved values on the chain, right?
When advancing the paxos instance:
multi-paxos-example/replicated_value.py
Line 190 in 924ae6c
Seems like like you're setting the value for the next instance instead of the current one.
I understand that the instance number needs to be advanced, but I'd have expected to happen only after saving the current consented value for the current instance. But looking into the self.advance_instance
implementation that doesn't seem to be what's happening.
ps: Thanks for putting this repo together, it's been a great help!
Hi! First let me say thank you for this fantastic project. It's been immensely helpful for me learning how Paxos works.
I'm also still far from an expert here, and I haven't actually tried reproducing this bug. It's purely theoretical and I might be wrong.
In receive_nack, the proposer waits until it receives a quorum of nacks before retrying with prepare()
. In a scenario where at least one peer is partitioned, it's possible for the responses to be split between successful promises and nacks such that a quorum of neither ever happens. In that case, the algorithm can get stuck, even though an overall quorum of peers is responding.
Concrete example: 5 nodes total (ABCDE). 3 are up (ABC) and 2 are offline (DE). A sends a prepare message to BC. B accepts the prepare and responds with a promise. C has already seen a higher prepare (perhaps from D before it went offline) and nacks. Now A has agreement from B and disagreement from C, and is stuck waiting for another vote from D or E in order to reach a three node (including itself) quorum.
There are a couple of potential ways this could be resolved. The simplest would be to send a new prepare as soon as we receive the first nack, although that could be inefficient.
Am I missing something or is this a real problem?
Thanks,
Ben
Hi, Tom,
How are you doing? I really appreciate that you can create this repo to show me the theories behind multi-paxos. I am trying to run the server code on different devices and make them talk to each other. In the read me your say, it is assumed that all of the servers and the client will be run on the same screen but in different terminals. I wonder is that a must that you need to run all code on the same machine or it is possible to run on different machines through changing the config file.
You help will be much appreciated.
Best Regards,
Jeffery
there are lots of methods which call the methods of superclass that there exactly isn't this method in the superclass and the names of these two methods are always the same. Is this a special feature for Python?
eg. super(SimpleSynchronizationStrategyMixin,self).set_messenger(messenger)
the superclass of SimpleSynchronizationStrategyMixin is object not containing the method "set_messenger". Exactly the name of method containing this line of code is also "set_messenger"
I've noticed that in your implementation of a replicated state machine the instance number is only advanced upon resolution.
So presumably clients can only issue a new proposal once the current one has been resolved.
Is there a simple way of adding support for multiple concurrent proposals?
Hi Tom:
How is everything going?
I listened your suggestion and read your code
https://github.com/cocagne/multi-paxos-example
but something wrong when I try to run "python server.py A"
It said
Traceback (most recent call last):
File "server.py", line 45, in <module>
m = Messenger(args.uid, config.peers, r)
File "C:\Users\xiaoj\Documents\multi-paxos-example\messenger.py", line 19, in __init__
for k,v in self.addrs.items():
RuntimeError: dictionary changed size during iteration
and the line 19 of messenger.py is here:
# provide two-way mapping between endpoints and server names
for k,v in self.addrs.items():
self.addrs[v] = k
I don't understand what's the meaning of those two line, you could help me about that? Thank you!
best wishes!
Jin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.