├── .gitignore
├── doc
├── RPC-Step-0.png
├── RPC-Step-1.png
├── RPC-Step-2.png
├── RPC-Step-3.png
├── RPC-Step-4.png
└── structure.png
├── logos
├── logo-square.png
├── logo-full-sq-black.png
├── logo-full-sq-white.png
├── logo-full-rect-black.png
└── logo-full-rect-white.png
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 | npm-debug.log
4 | .DS_Store
5 |
--------------------------------------------------------------------------------
/doc/RPC-Step-0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/doc/RPC-Step-0.png
--------------------------------------------------------------------------------
/doc/RPC-Step-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/doc/RPC-Step-1.png
--------------------------------------------------------------------------------
/doc/RPC-Step-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/doc/RPC-Step-2.png
--------------------------------------------------------------------------------
/doc/RPC-Step-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/doc/RPC-Step-3.png
--------------------------------------------------------------------------------
/doc/RPC-Step-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/doc/RPC-Step-4.png
--------------------------------------------------------------------------------
/doc/structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/doc/structure.png
--------------------------------------------------------------------------------
/logos/logo-square.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/logos/logo-square.png
--------------------------------------------------------------------------------
/logos/logo-full-sq-black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/logos/logo-full-sq-black.png
--------------------------------------------------------------------------------
/logos/logo-full-sq-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/logos/logo-full-sq-white.png
--------------------------------------------------------------------------------
/logos/logo-full-rect-black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/logos/logo-full-rect-black.png
--------------------------------------------------------------------------------
/logos/logo-full-rect-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bitfinexcom/grenache/HEAD/logos/logo-full-rect-white.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 bitfinexcom
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | Grenache is a DHT based high-performance microservices framework by Bitfinex.
4 | It's decentralised and optimized for performance. Because it's simple, it's easy
5 | to understand and to set up.
6 |
7 | Grenache uses Distributed Hashtables, known from Bittorrent, to build a network between peers.
8 | It's based on [Kademlia](https://en.wikipedia.org/wiki/Kademlia).
9 |
10 | Peers can send each other commands (RPC), and they can also store values in the DHT.
11 | Pub/Sub is also possible.
12 |
13 | The [Grenache Ecosystem](#implementations) supports Ruby and Node.js. There are multiple transports available: HTTP (plain & TLS), Websocket (plain & TLS), ZeroMQ.
14 |
15 | ## Contents
16 |
17 | - [Features](#features)
18 | - [Implementations](#implementations)
19 | - [Grape Network Composition](#grape-network-composition)
20 | - [Grenache in Action: a RPC example](#grenache-in-action-a-rpc-example)
21 | - [Articles](#articles)
22 | - [Background](#background)
23 | - [Contribute](#contribute)
24 | - [Contacts](#contacts)
25 |
26 | ## Features
27 |
28 | * Decentralised / Distributed architecture
29 | * Easy Bootstrap
30 | * Indefinite scalability and shapes
31 | * High-Performance
32 |
33 | ## Implementations
34 |
35 | ### Grape (the core)
36 |
37 | * https://github.com/bitfinexcom/grenache-grape
38 |
39 | ### Peer Implementations
40 |
41 | Transports:
42 | * WebSocket transport: super-fast, great for Internet
43 | * HTTP transport: great for Internet
44 | * ZeroMQ transport: super-fast, perfect for internal networks
45 |
46 | Patterns:
47 | * PUT/GET: put/get data to/from the DHT
48 | * RPC: simple and efficient RPC pattern
49 | * PUB/SUB: (Work In Progress)
50 |
51 | Note: At the moment there is no interoperability between WebSocket and ZeroMQ implementations. A Proxy implementation will come later.
52 |
53 | #### Node.JS Clients
54 | * https://github.com/bitfinexcom/grenache-nodejs-ws: WebSocket based Grape microservices
55 | * https://github.com/bitfinexcom/grenache-nodejs-http: HTTP based Grape microservices
56 | * https://github.com/bitfinexcom/grenache-nodejs-zmq: ZeroMQ based Grape microservices
57 | * https://github.com/bitfinexcom/grenache-nodejs-ws-tls: WebSocket based Grape microservices with TLS support
58 | * https://github.com/bitfinexcom/grenache-nodejs-link: HTTP based connections to the DHT
59 |
60 | #### Ruby Clients
61 | * https://github.com/bitfinexcom/grenache-ruby-ws: WebSocket based Grape microservices
62 | * https://github.com/bitfinexcom/grenache-ruby-http: HTTP based Grape microservices
63 |
64 | #### CLI Clients
65 | * https://github.com/bitfinexcom/grenache-cli: Command Line Interface for Grape microservices
66 |
67 |
68 | ## Grape Network Composition
69 |
70 | ### 1. The Grape: Grenache Discovery Node
71 |
72 | Grenache-Grape builds the Grenache Network. It offers multiple DHT interaction APIs for Clients: service discovery and DHT data storage.
73 |
74 | **Features**
75 |
76 | * Announce a Service
77 | * Lookup a Service
78 | * Push data to DHT
79 |
80 | ### 2. Clients: Grenache Client implementations on specific Transports
81 |
82 | Grenache supports WebSocket, HTTP (plain / TLS) and ZeroMQ as transport protocols.
83 |
84 | **Features**
85 |
86 | * Offer / Publish a Service: create and announce a service on the DHT
87 | * Request / Subscribe to Service: find a service throught the DHT and connect to it
88 | * Store and retrieve data in the DHT
89 |
90 |
91 | ## Grenache in Action: a RPC example
92 |
93 | Within a Grenache network, connected peers can interact in different ways with each other.
94 | 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.
95 |
96 |
97 |
98 | 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.
99 |
100 | Our workers announce their service to the DHT:
101 |
102 |
103 |
104 | Now peers can make use of the service and send commands to a service. They send their remote command to the DHT.
105 |
106 |
107 |
108 | 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.
109 |
110 |
111 |
112 | Finally the client connects to both workers, who are executing the command and send back the result to the client.
113 |
114 |
115 |
116 | ## Articles
117 |
118 | * http://blog.bitfinex.com/tutorial/bitfinex-loves-microservices-grenache/
119 | * https://medium.com/bitfinex/introducing-svc-js-a-framework-for-grenache-7119f2d7769e
120 | * http://blog.bitfinex.com/tutorial/grenache-cli-command-line-interface/
121 |
122 | ## Background
123 |
124 | * [Distributed Hash Table](http://www.bittorrent.org/beps/bep_0005.html) introduction
125 | * [Kademlia on Wikipedia](https://en.wikipedia.org/wiki/Kademlia)
126 | * [Kademlia: A Peer-to-Peer Information System Based on the XOR Metric](http://www.ic.unicamp.br/~bit/ensino/mo809_1s13/papers/P2P/Kademlia-%20A%20Peer-to-Peer%20Information%20System%20Based%20on%20the%20XOR%20Metric%20.pdf)
127 |
128 | ## Contribute
129 |
130 | Any contribution in form of question, issue, idea and pull requests is well accepted
131 |
132 | ## Contacts
133 | * [Paolo Ardoino](https://github.com/prdn)
134 |
--------------------------------------------------------------------------------