Skip to content

bchu7796/casual-consistent-distributed-system

Repository files navigation

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.

Examples

The following image shows the problem caused by unexpected ordering.

Test Image 1

The system enforces causal ordering and prevent the issue shown in the image.

Download and Compile

  1. Clone the repository

    https://github.com/bchu7796/CausalConsistencyServer.git
  2. Go to the work directory

    cd CausalConsistencyServer/
  3. Compile

    make all 
  4. Execute server

    ./server
  5. Execute client

    ./client

Client Commands

  1. Read a variable

    read 'key'
  2. Write a variable

    write 'key' 'value' 

Testing

  1. Unzip "test_env.zip"

    unzip test_env.zip
  2. Go to test_env directory

    cd test_env
  3. Compile

    make all
  4. Execute client and server in client_server1/, client_server2/, and client_server3/

  5. Emulate the example shown in "Examples" section.

    1. In client1, write lost
      >write x lost
    2. In client1, write found
      >write y found
    3. In client2, read found
      >read y
    4. In client2, write glad
      >write z glad
    5. Server3 would delay message z from client2 until it receives message x.

About

An implementation of causal consistency distributed system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published