All Projects → mrhooray → Swim Js

mrhooray / Swim Js

JavaScript implementation of SWIM membership protocol

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Swim Js

Nuraft
C++ implementation of Raft core logic as a replication library
Stars: ✭ 428 (+217.04%)
Mutual labels:  consensus, distributed-systems
Awesome Distributed Systems
A curated list to learn about distributed systems
Stars: ✭ 7,263 (+5280%)
Mutual labels:  consensus, distributed-systems
Copycat
A novel implementation of the Raft consensus algorithm
Stars: ✭ 551 (+308.15%)
Mutual labels:  consensus, distributed-systems
Dragonboat
Dragonboat is a high performance multi-group Raft consensus library in pure Go.
Stars: ✭ 3,983 (+2850.37%)
Mutual labels:  consensus, distributed-systems
Library
Collection of papers in the field of distributed systems, game theory, cryptography, cryptoeconomics, zero knowledge
Stars: ✭ 100 (-25.93%)
Mutual labels:  consensus, distributed-systems
Raft
Raft Consensus Algorithm
Stars: ✭ 370 (+174.07%)
Mutual labels:  consensus, distributed-systems
Hraftd
A reference use of Hashicorp's Raft implementation
Stars: ✭ 732 (+442.22%)
Mutual labels:  consensus, distributed-systems
little-raft
The lightest distributed consensus library. Run your own replicated state machine! ❤️
Stars: ✭ 316 (+134.07%)
Mutual labels:  distributed-systems, consensus
Zookeeper
Apache ZooKeeper
Stars: ✭ 10,061 (+7352.59%)
Mutual labels:  distributed-systems, consensus
Rqlite
The lightweight, distributed relational database built on SQLite
Stars: ✭ 9,147 (+6675.56%)
Mutual labels:  consensus, distributed-systems
Js
Gryadka is a minimalistic master-master replicated consistent key-value storage based on the CASPaxos protocol
Stars: ✭ 304 (+125.19%)
Mutual labels:  consensus, distributed-systems
Bifrost
Pure rust building block for distributed systems
Stars: ✭ 118 (-12.59%)
Mutual labels:  consensus, distributed-systems
epaxos
A pluggable implementation of the Egalitarian Paxos Consensus Protocol
Stars: ✭ 39 (-71.11%)
Mutual labels:  distributed-systems, consensus
Tendermint
⟁ Tendermint Core (BFT Consensus) in Go
Stars: ✭ 4,491 (+3226.67%)
Mutual labels:  consensus, distributed-systems
coolbeans
Coolbeans is a distributed work queue that implements the beanstalkd protocol.
Stars: ✭ 56 (-58.52%)
Mutual labels:  distributed-systems, consensus
Translations
🐼 Chinese translations for classic IT resources
Stars: ✭ 6,074 (+4399.26%)
Mutual labels:  consensus, distributed-systems
Awesome Substrate
A curated list of awesome projects and resources related to the Substrate blockchain development framework.
Stars: ✭ 228 (+68.89%)
Mutual labels:  consensus, distributed-systems
raftor
Distributed chat system built with rust
Stars: ✭ 31 (-77.04%)
Mutual labels:  distributed-systems, consensus
Abci Host
Clojure host/server for Tendermint's ABCI protocol.
Stars: ✭ 18 (-86.67%)
Mutual labels:  consensus, distributed-systems
Etcd
Distributed reliable key-value store for the most critical data of a distributed system
Stars: ✭ 38,238 (+28224.44%)
Mutual labels:  consensus, distributed-systems

swim-js Build Status

JavaScript implementation of SWIM membership protocol

Motivation

Membership management is important to distributed systems and large clusters need a decentralized protocol such as SWIM, which handles failure detection and membership dissemination in a scalable and weakly-consistent way. It can be used to implement functionalities based on membership like distributed consensus, application layer sharding, log replication, etc.

Usage

Installation

npm install swim --save
var Swim = require('swim');
var opts = {
    local: {
        host: '10.31.1.191:11000',
        meta: {'application': 'info'} // optional
    },
    codec: 'msgpack', // optional
    disseminationFactor: 15, // optional
    interval: 100, // optional
    joinTimeout: 200, // optional
    pingTimeout: 20, // optional
    pingReqTimeout: 60, // optional
    pingReqGroupSize: 3, // optional
    suspectTimeout: 60, // optional
    udp: {maxDgramSize: 512}, // optional
    preferCurrentMeta: true // optional
};
var swim = new Swim(opts);
var hostsToJoin = ['10.31.1.192:11000', '10.31.1.193:11000'];

swim.bootstrap(hostsToJoin, function onBootstrap(err) {
    if (err) {
        // error handling
        return;
    }

    // ready
    console.log(swim.whoami());
    console.log(swim.members());
    console.log(swim.checksum());

    // change on membership, e.g. new node or node died/left
    swim.on(Swim.EventType.Change, function onChange(update) {});
    // update on membership, e.g. node recovered or update on meta data
    swim.on(Swim.EventType.Update, function onUpdate(update) {});

    // shutdown
    swim.leave();
});

// or
swim.bootstrap(hostsToJoin);
// bootstrap error handling
swim.on(Swim.EventType.Error, function onError(err) {});
// bootstrap ready
swim.on(Swim.EventType.Ready, function onReady() {});

Additional API Documentation

Benchmark

Benchmark convergence time under different configuration

node bench/script/convergence-time.js -h

  Usage: convergence-time [options]

  Options:

    -h, --help                      output usage information
    --cycles [value]                number of cycles
    --workers [value]               number of workers
    --codec [value]                 msgpack or json
    --dissemination-factor [value]  dissemination factor
    --interval [value]              interval
    --join-timeout [value]          join timeout
    --ping-timeout [value]          ping timeout
    --ping-req-timeout [value]      ping req timeout
    --ping-req-group-size [value]   ping req group size
    --max-dgram-size [value]        max dgram size
node bench/script/convergence-time.js

configuration:
- cycles 10
- workers 10
- codec msgpack
- dissemination factor 15
- interval 20 ms
- join timeout 100 ms
- ping timeout 4 ms
- ping req timeout 12 ms
- ping req group size 3
- max dgram size 512 bytes
convergence time under single node failure
histogram data:
- count 10
- min 76
- max 123
- mean 100
- median 101
- variance 308.44444444444446
- std dev 17.56258649642599
- p75 116.25
- p95 123
- p99 123

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].