GithubHelp home page GithubHelp logo

utracker's Introduction

MasterNode

WIP - uWS pub/sub cluster master node

Usage

A very simple set-up consists of 3 steps:

  1. Deploy the (one) MasterNode executable
  2. Mark your uWS instances as workers of this MasterNode (functionality to be added to uWS itself).
  3. Use uWSClusterConnector library in the producer to easily publish messages to this uWS cluster.

Both producer and workers need to know the IP of the MasterNode.

Problem with Redis

Many users of uWS pub/sub use Redis to distribute a message from the producer, to many uWS instances. This works fine for small cases but introduces an extra hop and bottlenecks every single message at the Redis instance, here marked red:

A distributed solution

Instead of copying every single message via Redis, the idea with MasterNode (name pending!) is to allow an easy-to-setup distributed alternative where no single instance becomes a bottleneck:

Producers send directly to the uWS instances and use only a simple bookkeeping node, MasterNode, for keeping track of available uWS instances. Compared with Redis, MasterNode does not receive any significant traffic - it merely keeps track of online uWS instances.

Reducing internal traffic

Even though the source(s) and uWS instaces communicate over internal LAN, one can still reduce unnecessary traffic. Because the uWS instances are directly connected to the source(s), the two parts can exchange subscription lists. By doing so, the source(s) can know which uWS instance(s) it should send a publish to. This is an optimization that really only makes sense for large amounts of uWS instances as it is typically not a problem sending LAN traffic to a handful endpoints.

Whenever a subscription takes place in an uWS instance, and this topic is new for the uWS instance, it sends the new topic name to all connected sources. If the source goes offline, on reconnect the whole subscription list is sent again. Same goes for unsubscription; if the last subscriber to a topic unsubscribes, this removed topic name is sent to all connected sources so that they know not to send to this uWS instance.

The sources then need a tree where it can map outgoing publishes to uWS instances in O(log n). This is implemented in the helper library for Node.js (uWSClusterConnector) and should support wildcard supscriptions.

utracker's People

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.