Tube, my Raft implementation in Golang, is now open source.

8 views
Skip to first unread message

Jason Aten

unread,
Sep 20, 2025, 12:19:30 PM (3 days ago) Sep 20
to raft-dev


I've released my Raft implementation, which is
integrated with a high performance RPC system for Go.


tube: a small RAFT in Golang
Author: Jason E. Aten, Ph.D.

Initial release: 2025 September 18

The rpc25519/tube/ subdirectory contains Tube, a tested and working implementation of Diego Ongaro's Raft algorithm for distributed consensus (https://raft.github.io/). Raft is a better organized and more concretely specified version of Multi-Paxos.

There is a getting started with Tube guide here: https://github.com/glycerine/rpc25519/blob/master/tube/example/local/README.md

From the Tube introduction in tube.go, the central implementation file, the name Tube is midwestern shorthand for "innertube", and is referring the the sport of "tubing", which involves rafting down rivers.

> A tube is a small raft, delightfully used for floating down rivers on a sunny summer's day in some parts of the world.

Tube implements the Pre-voting and Sticky-leader optimizations, and includes core Raft (chapter 3 of Ongaro's 2014 Raft dissertation), membership changes (chapter 4), log compaction (chapter 5), and client-side interaction sessions for linearizability (chapter 6). We use the Mongo-Raft-Reconfig algorithm for single-server-at-a-time membership changes ( https://arxiv.org/abs/2102.11960 ), as it provides a clean separation of membership and Raft log data; and is formally proven correct.

Tube provides a basic sorted key/value store as its baseline/sample/example state machine (which may suffice for many use cases). User program defined replicated operations -- custom state machine actions for a user defined machine -- are planned but still TODO at the moment. The built in key/value store allows arbitrary []byte or string keys to refer to arbitrary []byte slice values. Multiple key-value namespaces, each called a "table", are available. See the tube/cmd/tup utility for a sample client/client code.
Shadow replicas that maintain state but do not vote are available; see tubeadd -shadow node_4 and tuberm -shadow node_4, for example.

Testing uses the Go testing/synctest package (https://pkg.go.dev/testing/synctest) and our own gosimnet network simulator (https://github.com/glycerine/gosimnet) whose implementation is embedded here in simnet.go.

On Go 1.24.3 or Go 1.25, the synctest tests run with GOEXPERIMENT=synctest go test -v; or GOEXPERIMENT=synctest go test -v -race
Reply all
Reply to author
Forward
0 new messages