Code Monkey home page Code Monkey logo

raft-go's Introduction

raft-go

Sample GRPC service prepared for embedded devices & IoT where orchestration (like k8s) is not present.

Service is using etcd implementation of Raft algorithm (https://github.com/etcd-io/raft).

Prerequisites:

  • Go 1.19
  • GRPC for Go (check make install)
  • Goreman

Assumptions

Scope:

  • embedded service composed of N nodes

  • each service is using Raft consensus algorithm to find the leader

  • leader handles basic API operations using GRPC

Goals:

  • check in details how Raft works

  • check performance of such service

  • check how resilient such service is and what's the impact of failures on service performance

Design

Design is borrowed from raft example which is based on REST API

and fits GRPC needs perfectly too.

The service consists of three components:

  • a raft-backed key-value store,
  • a GRPC server
  • a raft consensus server based on etcd's raft implementation.

The raft-backed key-value store is a key-value map that holds all committed key-values. The store bridges communication between the raft server and the GRPC server. Key-value updates are issued through the store to the raft server. The store updates its map once raft reports the updates are committed.

The GRPC server exposes the current raft consensus by accessing the raft-backed key-value store.

The raft server participates in consensus with its cluster peers. When the GRPC server submits a proposal, the raft server transmits the proposal to its peers. When raft reaches a consensus, the server publishes all committed updates over a commit channel. In our case, this commit channel is consumed by the key-value store.

Other docs

raft-go's People

Contributors

m-wrona avatar

Watchers

 avatar

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.