wuhanmonkey / udpserverclient Goto Github PK
View Code? Open in Web Editor NEWUDP server client with simulated delay
UDP server client with simulated delay
Given the wording in the requirements as well as later required
functionality it seems that these commands only execute locally instead of
globally as it is currently done. Can you confirm this, so I can go ahead on
the change?
Tested with continue. Out of Index on line 144 which just printing out the message. show-all still been broadcast out. Working on it now.
I think we should not use a central server for eventual consistency, or at least we should mute the broadcast of central server.
Here is the reason:
When sending request for 'insert', 'get' or 'update', if it go through the central server, the central server will broadcast it. Since we ensure FIFO on the node, they will be added into the priority queue. Thus, there would be no inconsistency since all operations will be process in the same order across the node and result in a linear or sequencial consistency.
What we should do:
1.When we choose model 3 or 4 on Central server, it acknowledge all nodes.
2.Except for 'get', 'insert' and 'update', other operation should still go through the central server and been broadcasted if necessary.
3.For 'get', 'insert' and 'update', the local node will not send request to central server. Instead, it sends the request to other 3 nodes. Collect acks based on W=k and R=k.
To avoid impacting the rest of the code as much as possible, periodic
repair is probably going to be our best option. Something of the form:
<In Central_server.py>
if int(time.time() % 10) == 5:
repairInconsistencies()
or
if message and (message.split(" "))[0].lower() != 'ack':
count += 1
if count > 5:
count = 0
repairInconsistencies()
where the function sends out a special show-all to the clients where
the client doesn't print it out on the terminal but sends the results and
modified time to the server. Then the server adds all the values to a
temporary dict on it's own side. It replaces only if time in dict > new time.
When all special show-all have been received, it iterates through each
key in the dict and sends a insert for that specific key-value
for key in tmpData:
for s in self.server_list:
nmsg = 'insert ' + key + ' ' + (tmpData[key])[0] + ' ' + self.model + ' ' s
self.s_send.sendto(nmsg, (self.h, int(s)))
time.sleep(0.2)
This requires modifying insert and update so that the hashtable
data has a tuple (value, sysTime) instead of the current value
From Milestone:
The client node does not receive the results of the Send operation until all
As replicas may grow out of sync with each other, have a way to repair the
these inconsistencies via last-writer-win rule. We can use any of the three
following methods to do this:
write repair
read repair
periodic repair
We will probably have to amend the heldAcks dict to include the
command that was issued. Since Python keys can use tuples as keys
because tuples are immutable, we can change the keys to the following:
heldAcks key is [(command, key)]
This should have minimal change to the existing code.
From the Milestone:
For Model 3&4 (Eventual Consistency):
The client node does not receive the results of the Send operation until all
nodes have done the operation and ACKed the Central server. In this case
the central server is responsible for processing the Acks and determining
which is the correct response.
This is done by comparing timestamps.
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.