An implementation of causal consistency distributed system.
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
cd test_env
make all
Execute client and server in client_server1/, client_server2/, and client_server3/
Emulate the example shown in “Examples” section.
>write x lost
>write y found
>read y
>write z glad