avkapustin / membership

Membership library for Tarantool based on a gossip protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pipeline status

Membership library for Tarantool based on a gossip protocol

This library builds a mesh from multiple tarantool instances. The mesh monitors itself, helps members discover everyone else and get notified about their status changes with low latency.

It is built upon the ideas from consul, or, more precisely, the SWIM algorithm.

Membership module works over UDP protocol and can operate even before tarantool box.cfg was initialized.

Member data structure

A member is represented by the table with fields:

  • uri
  • status is a string: alive, suspect, dead or left
  • incarnation which is incremented every time the instance is being suspected or dead or updates its payload
  • payload is a table with auxiliary data, which can be used by various modules to do whatever they want
  • timestamp is a value of fiber.time64() (in microseconds), corresponding to the last update of status or incarnation. timestamp is always local and does not depent on other members' clock setting.
  • clock_delta is a time drift between member's clock (remote) and the local one (in microseconds).

Example:

---
uri: "localhost:33001"
status: "alive"
incarnation: 1
payload:
    uuid: "2d00c500-2570-4019-bfcc-ab25e5096b73"
timestamp: 1522427330993752
clock_delta: 27810
...

About

Membership library for Tarantool based on a gossip protocol


Languages

Language:Lua 67.9%Language:Python 25.9%Language:CMake 5.3%Language:Shell 0.9%