Coder Social home page Coder Social logo

csc-591-dic's Introduction

CSC-591-DIC

Distributed In-Memory Key Value Store

This project is based off of Amazon's Dynamo paper with certain design modifications as specified in the report.

System architecture:

System Architecture
The components present are Client, Proxy Server, Request Coordinators and Memory Nodes.

Sequence diagram:

Sequence Diagram

Client sends the get or put request to the Proxy server to retrieve the IP address of the request coordinator. Primary purpose of request proxy server is to balance the load of incoming requests to all the coordinators in a round-robin fashion. Upon receiving the IP of the current request coordinator, client now sends the request directly to the coordinator. Note that this process happens in the background and not visible to the client. This is done so that proxy server only does the work of load balancing.

Request coordinator now computes hash from the key to determine which memory node to choose from the ring structure (explained below) to store this key value pair. The request coordinator then sends the request to the primary memory node and to it's next N replicas in the ring at the same time. We follow quorum protocol to acknowledge successful read or write operation. After successful acknowledgement from all at least W or R memory nodes, request coordinator acknowledges the client about the success or failure of the request.

Operations Supported:

  1. put
  2. get

System Interface:

A client can interact with system via simple REST calls. A get request with the key would fetch the value for that key and a post request with a key value pair would set the key in the memory node. If a post request with an existing key is set, then it will overwrite the previously set value. These requests can be sent by simple curl commands or by using utilities like Postman. To make the task of sending these requests easier, we've integrated the client with Slack so that requests can now be sent by using Slack commands instead of typing commands on terminal

Usage

  1. Clone this repo
  2. Create a jar file containing code in the src directory
  3. Install Java v8 for proxy server, request coordinator and memory nodes. Install Java, Nodejs and npm for client. You can have a dedicated machine for proxy server, request coordinator and memory nodes can run on same machine. Since replication factor is 2, we need atleast one request coordinator and 2 memory nodes for successful write operation and 1 memory node for successful operation as per quorom protocol.
  4. Run the following files in sequence:
    4.1 Start the proxy server on a machine: java -cp jarfile.jar kv_proxy.ProxyProc
    4.2 Start n request coordinators as needed passing prox: java -cp jarfile.jar kv_requestCoordinator.Server <proxy server IP>
    4.3 Start atleast 2 memory nodes: java -cp jarfile.jar kv_memNodes.MemNodeProc <proxy server IP>
    4.4 Start client: java -cp jarfile.jar kv_client.ClientServer <proxy server IP>
    4.5 Optionally you send put/get request via Slack slash commands. Follow this tutorial to set up slack slash command for your team and add SLACK_TOKEN_GET and SLACK_TOKEN_PUT to your environment variables. You will also need to use ngrok to establish a tunnel for your slack slash command inorder to run slash commands on local server.
    Go to kv_slack folder, run npm install to install all dependencies, run node client.js to start the Slack server.
  5. Perform put/get operations in the datastore using HTTP requests. You can use cURL, Postman or Slack to perform HTTP requests.

Sample Requests:

Postman put operation: Postman
Slack put operation:
Slack put
Slack get operation: Slack get

csc-591-dic's People

Contributors

imabhishekl avatar vipulkashyap111 avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

csc-591-dic's Issues

Auto-scaling

Add node to the ring structure and update the routing table.

Client Application

Create a client application that listens to client (set, get) requests and calls the proxy server.

Replication Demon

Send requests to next k node to maintain data replication. k is user-defined taken from a config file

Ring Structure

Implement ring structure for all the servers available to store key and values

Request co-ordinator

This will perform one of the 2 tasks:
Check if it's supposed to process this key (i.e. it is one of the N preferred Node for this key).

  1. If yes, it is responsible for identifying the nodes responsible for a key, sending the requests (to all the N nodes in the preference list), waiting for responses, potentially doing retries, processing the replies and packaging the response to the client
  2. If No, forward the request to the first among the top N nodes in the preference list.

Consistent Hashing

Implement Consistent Hashing to determine which node to send request to from the user key sent.

Consistency Protocol

Implement quorum system for consistency. W and R should be set from a config file. Need to assure that W + R > K, where K = No. of replications

Setup all servers

Install all required dependencies on the servers to run the program

Proxy Server

Create a proxy server that will send client request to every server in a round robin fashion. This server should also maintain latest routing table and update it when nodes are down.
Also create a second server(back-up) with same code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.