Coder Social home page Coder Social logo

gord's Introduction

Gord

This repository goals a reference implementation of Chord protocol.

What is Gord?

Gord is a peer-to-peer lookup service for internet applications. Gord provides an ability to return which server node a given key belongs to by cooperating with other Gords, which are distributed across other servers. Gord will start as a gRPC server and your application can determine which node should contain your data by simply giving Gord a key via gRPC.

Features

  • Resolve the node which a given key belongs to

How is it work?

Gord is an implementation of DHT Chord. Chord protocol is an algorithm which extends consistent hashing. Gord server, using chord protocol, allocates a key to a node in distributed nodes ring.

chord ring

In addition, the gord servers communicate with each other via gRPC to synchronize route information. Then, the client can query via gRPC to resolve the node.

gRPC server

Usage

Gord's gRPC server listens 26041 port by default.

## Build
make build

## Check how to use this command
./gordctl -h

## Start server
./gordctl -l hostName(required) -n existNodeHostName(optional)

Examples

  1. Install grpcurl

  2. Start servers

# start three server processes
docker-compose build && docker-compose up
  1. Try!
# Check successor list for each node
grpcurl -plaintext localhost:26040 server.InternalService/Successors \
&& grpcurl -plaintext localhost:36040 server.InternalService/Successors \
&& grpcurl -plaintext localhost:46040 server.InternalService/Successors

# Check predecessor for each node
grpcurl -plaintext localhost:26040 server.InternalService/Predecessor \
&& grpcurl -plaintext localhost:36040 server.InternalService/Predecessor \
&& grpcurl -plaintext localhost:46040 server.InternalService/Predecessor

# Query
grpcurl -plaintext -d '{"key": "gord1"}' localhost:26041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord1"}' localhost:36041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord1"}' localhost:46041 server.ExternalService/FindHostForKey 

grpcurl -plaintext -d '{"key": "gord2"}' localhost:26041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord2"}' localhost:36041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord2"}' localhost:46041 server.ExternalService/FindHostForKey 

grpcurl -plaintext -d '{"key": "gord"}' localhost:26041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord"}' localhost:36041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord"}' localhost:46041 server.ExternalService/FindHostForKey 

How to build

make build

How to run tests

make test

gord's People

Contributors

taisho6339 avatar

Stargazers

Ryo Kanbayashi avatar  avatar Roman avatar

Watchers

James Cloos avatar  avatar

Forkers

ryogrid

gord's Issues

The Road to Completion

TODO

  • Implement virtual node
  • Implement successor list
  • Implement leave node function
  • Implement join node function
  • Implement leave & join notification for applications which use gord
  • Implement connection pooling for grpc
  • Enable mTLS for internal connections
  • Add limitation to grpc connection count

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.