Code Monkey home page Code Monkey logo

grenache's Introduction

Grenache Logo

Grenache is a DHT based high-performance microservices framework by Bitfinex. Its decentralised and optimized for performance. Because its simple, it is easy to understand and to set up.

Grenache uses Distributed Hashtables, known from Bittorrent, to build a network between peers. Its based on Kademlia.

Peers can send each other commands (RPC), and they can also store values in the DHT. Pub/Sub is also possible.

The Grenache Ecosystem supports Ruby and Node.js. There are multiple transports available: HTTP (plain & TLS), Websocket (plain & TLS), ZeroMQ.

Contents

Features

  • Decentralised / Distributed architecture
  • Easy Bootstrap
  • Indefinite scalability and shapes
  • High-Performance

Implementations

Grape (the core)

Peer Implementations

Transports:

  • WebSocket transport: super-fast, great for Internet
  • HTTP transport: great for Internet
  • ZeroMQ transport: super-fast, perfect for internal networks

Patterns:

  • PUB/GET: put/get data to/from the DHT
  • RPC: simple and efficient RPC pattern
  • PUB/SUB: (Work In Progress)

Note: At the moment there is no interoperability between WebSocket and ZeroMQ implementations. A Proxy implementation will come later.

Node.JS Clients

Ruby Clients

Grape Network Composition

1. The Grape: Grenache Discovery Node

Grenache-Grape builds the Grenache Network. It offers multiple DHT interaction APIs for Clients: service discovery and DHT data storage.

Features

  • Announce a Service
  • Lookup a Service
  • Push data to DHT

2. Clients: Grenache Client implementations on specific Transports

Grenache supports WebSocket, HTTP (plain / TLS) and ZeroMQ as transport protocols.

Features

  • Offer / Publish a Service: create and announce a service on the DHT
  • Request / Subscribe to Service: find a service throught the DHT and connect to it
  • Store and retrieve data in the DHT

Grenache in Action: a RPC example

Within a Grenache network, connected peers can interact in different ways with each other. They can store and retrieve data in the DHT. They can also work in a Pub/Sub pattern. Or they can work in RPC mode, with different workers and clients.

DHT with 2 workers and one client

In the diagram above we see three Grape nodes forming the DHT network. We have two workers connected. There is also another peer which will act as client.

Our workers announce their service to the DHT:

Step 1: worker announces service

Now peers can make use of the service and send commands to a service. They send send their remote command to the DHT.

Step 2: worker announces service

The DHT looks up any peers that announce the service. In our case the two workers. The client receives the IP of the two workers.

Step 3: worker announces service

Finally the client connects to both workers, who are executing the command and send back the result to the client.

Step 4: worker announces service

Background

Contribute

Any contribution in form of question, issue, idea and pull requests is well accepted

Contacts

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.