When a distributed system is composed of multiple servers/datacenters and multiple clients. It might encounter issues related to ordering. The messages travel through the Internet might arrived replicated servers in unexpected order. If these messages are causal related, the state of the servers would suffer from inconsistency.
The system implemented is aim at solving the problem metioned earlier. The servers commit replicated requests in causal ordering, this allows distributed system to stay in causal consistency.
The following image shows the problem caused by unexpected ordering.
The system enforces causal ordering and prevent the issue shown in the image.
-
Clone the repository
https://github.com/bchu7796/CausalConsistencyServer.git
-
Go to the work directory
cd CausalConsistencyServer/
-
Compile
make all
-
Execute server
./server
-
Execute client
./client
-
Read a variable
read 'key'
-
Write a variable
write 'key' 'value'
-
Unzip "test_env.zip"
unzip test_env.zip
-
Go to test_env directory
cd test_env
-
Compile
make all
-
Execute client and server in client_server1/, client_server2/, and client_server3/
-
Emulate the example shown in "Examples" section.
- In client1, write lost
>write x lost
- In client1, write found
>write y found
- In client2, read found
>read y
- In client2, write glad
>write z glad
- Server3 would delay message z from client2 until it receives message x.
- In client1, write lost