ScaleCube is a lightweight decentralized cluster-membership library features: failure detection, SWIM and gossip protocols for the Java VM based on these unique features scalecube also implements microservices coordination library.
Java Shell
Clone or download

README.md

ScaleCube

Build Status Maven Central Codacy Badge Codacy Badge Join the chat at https://gitter.im/scalecube/Lobby Twitter URL

Welcome to scalecube! if you are new to scalecube:

Please read ScaleCube-services Motivations and vision

Overview

ScaleCube project provides the tools to develop, test and scale distributed components in a cluster with ease. it provides a general purpose cluster-membership library based on SWIM Membership protocol with gossip protocol as improvement. scalecube-cluster is Embeddable and can be used by any cluster-aware application that requires cluster membership, node discovery, failure-detection and gossip style of communication across member nodes. based on that unique properties scalecube implements aditional seperated module for microservices coordination library that features service discovery, fault-tolerance at scale.

The project focuses on ensuring that your application realizes the full potential of the Reactive Manifesto, while delivering a high productivity development environment, and seamless production deployment experience.

Web Site: http://scalecube.io

Features

ScaleCube is designed as an embeddable library for the Java VM. It is built in a modular way where each module independently implements a useful set of functionality and provides foundation for higher level features by abstracting away lower level concerns.

Next is described modules in the top to bottom order from the higher level features to the low level components.

MICROSERVICES

ScaleCube Services provides a low latency Reactive Microservices library for peer-to-peer service registry and discovery based on gossip protocol ad without single point-of-failure or bottlenecks.

ScaleCube Services Features:

  • Provision and interconnect microservices as a unified system (cluster)
  • Async RPC with java-8 CompleteableFutures support
  • Reactive Streams support with RxJava.
  • No single-point-of-failure or single-point-of-bottleneck
  • Cluster aware and distributed
  • Modular, flexible deployment models and topology
  • Zero configuration, automatic peer-to-peer service discovery using gossip
  • Simple non-blocking, asynchronous programming model
  • Resilient due to failure detection, fault tolerance, and elasticity
  • Routing and balancing strategies for both stateless and stateful services
  • Low latency and high throughput
  • Takes advantage of the JVM and scales over available cores
  • Embeddable to existing Java applications
  • Message Driven based on google-protocol-buffers
  • Natural Circuit-Breaker due to tight integration with scalecube-cluster failure detector.
  • Support Service instance tagging.

User Guide:

CLUSTER

ScaleCube Cluster is a lightweight decentralized cluster membership, failure detection, and gossip protocol library. It provides an implementation of SWIM cluster membership protocol for Java VM. It is an efficient and scalable weakly-consistent distributed group membership protocol based on gossip-style communication between the nodes in the cluster. Read my blog post with distilled notes on the SWIM paper for more details.

It is using a random-probing failure detection algorithm which provides a uniform expected network load at all members. The worst-case network load is linear O(n) for overall network produced by running algorithm on all nodes and constant network load at one particular member independent from the size of the cluster.

ScaleCube Cluster implements all improvements described at original SWIM algorithm paper, such as gossip-style dissemination, suspicion mechanism and time-bounded strong completeness of failure detector algorithm. In addition to that we have introduced support of additional SYNC mechanism in order to improve recovery of the cluster from network partitioning events.

Using ScaleCube Cluster as simple as few lines of code:

// Start cluster node Alice as a seed node of the cluster, listen and print all incoming messages
Cluster alice = Cluster.joinAwait();
alice.listen().subscribe(msg -> System.out.println("Alice received: " + msg.data()));

// Join cluster node Bob to cluster with Alice, listen and print all incoming messages
Cluster bob = Cluster.joinAwait(alice.address());
bob.listen().subscribe(msg -> System.out.println("Bob received: " + msg.data()));

// Join cluster node Carol to cluster with Alice (and Bob which is resolved via Alice)
Cluster carol = Cluster.joinAwait(alice.address());

// Send from Carol greeting message to all other cluster members (which is Alice and Bob)
carol.otherMembers().forEach(member -> carol.send(member, Message.fromData("Greetings from Carol")));

You are welcome to explore javadoc documentation on cluster API and examples module for more advanced use cases.

TRANSPORT

ScaleCube Transport is a network communication layer which provides high throughput and low latency peer-to-peer messaging. It is based on Netty asynchronous networking framework and is using RxJava in order to provide convenient reactive API on top of network handlers pipelines.

Using ScaleCube Transport as simple as few lines of code:

// Bind first transport to port 5000
TransportConfig config1 = TransportConfig.builder().port(5000).build();
Transport transport1 = Transport.bindAwait(config1);

// Make first transport to listen and print all incoming messages
transport1.listen().subscribe(System.out::println);

// Get 'host:port' address of the first transport
Address address1 = transport1.address(); 

// Bind second transport on available port and send message to the first transport
Transport transport2 = Transport.bindAwait();
transport2.send(address1, Message.fromData("Hello World"));

You are welcome to explore javadoc documentation on transport API for more advanced use cases.

Support

For improvement requests, bugs and discussions please use the GitHub Issues or chat with us to get support on Gitter.

You are more then welcome to join us or just show your support by granting us a small star :)

Maven

Binaries and dependency information for Maven can be found at http://search.maven.org.

To add a dependency on ScaleCube Services using Maven, use the following:

<dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services</artifactId>
  <version>x.y.z</version> 
</dependency>

To add a dependency on ScaleCube Cluster using Maven, use the following:

<dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-cluster</artifactId>
  <version>x.y.z</version>
</dependency>

To add a dependency on ScaleCube Transport using Maven, use the following:

<dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-transport</artifactId>
  <version>x.y.z</version>
</dependency>

Contributing

  • Follow/Star us on github.
  • Fork (and then git clone https://github.com/--your-username-here--/scalecube.git).
  • Create a branch (git checkout -b branch_name).
  • Commit your changes (git commit -am "Description of contribution").
  • Push the branch (git push origin branch_name).
  • Open a Pull Request.
  • Thank you for your contribution! Wait for a response...

References

License

Apache License, Version 2.0