Home

Awesome

<img alt="Grenache Logo" width="50%" src="logos/logo-full-rect-black.png" />

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

Grenache uses Distributed Hashtables, known from Bittorrent, to build a network between peers. It's 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

Implementations

Grape (the core)

Peer Implementations

Transports:

Patterns:

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

Node.JS Clients

Ruby Clients

CLI 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

2. Clients: Grenache Client implementations on specific Transports

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

Features

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.

<img alt="DHT with 2 workers and one client" src="doc/RPC-Step-0.png" width="60%" />

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:

<img alt="Step 1: worker announces service" src="doc/RPC-Step-1.png" width="60%" />

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

<img alt="Step 2: worker announces service" src="doc/RPC-Step-2.png" width="60%" />

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.

<img alt="Step 3: worker announces service" src="doc/RPC-Step-3.png" width="60%" />

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

<img alt="Step 4: worker announces service" src="doc/RPC-Step-4.png" width="60%" />

Articles

Background

Contribute

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

Contacts