WPaxos is a multileader Paxos protocol that provides low-latency and high-throughput consensus across wide-area network (WAN) deployments. Unlike statically partitioned multiple Paxos deployments, WPaxos perpetually adapts to the changing access locality through object stealing. Multiple concurrent leaders coinciding in different zones steal ownership of objects from each other using phase-1 of Paxos, and then use phase-2 to commit update-requests on these objects locally until they are stolen by other leaders. To achieve fast phase-2 commits, WPaxos adopts the flexible quorums idea in a novel manner, and appoints phase-2 acceptors to be close to their respective leaders.
WPaxos (WAN Paxos) paper (first version) can be found in https://arxiv.org/abs/1703.08905.
Paxi is the framework that implements WPaxos and other Paxos protocol variants. Paxi provides most of the elements that any Paxos implementation or replication protocol needs, including network communication, state machine of a key-value store, client API and multiple types of quorum systems.
Warning: Paxi project is still under heavy development, with more features and protocols to include. Paxi API may change too.
- WPaxos
- EPaxos
- KPaxos (Static partitioned Paxos)
- Vertical Paxos
- WanKeeper
go get github.com/ailidani/paxi
- Compile everything.
cd github.com/ailidani/paxi/bin
./build.sh
After compile, Golang will generate 4 executable files under bin
folder.
master
is the easy way to distribute configurations to all replica nodes.server
is one replica instance.client
is a simple benchmark that generates read/write reqeust to servers.cmd
is a command line tool to test Get/Set requests.
Each executable file expects some parameters which can be seen by -help
flag, e.g. ./master -help
.
- Start master node with 6 replicas running WPaxos:
./master.sh -n 6 -protocol "wpaxos"
- Start 6 servers with different zone id and node ids.
./server -sid 1 -nid 1 -master 127.0.0.1 &
./server -sid 1 -nid 2 -master 127.0.0.1 &
./server -sid 2 -nid 1 -master 127.0.0.1 &
./server -sid 2 -nid 2 -master 127.0.0.1 &
./server -sid 3 -nid 1 -master 127.0.0.1 &
./server -sid 3 -nid 2 -master 127.0.0.1 &
- Start benchmarking client with 10 threads, 1000 keys, 50 percent conflicting commands and run for 60 seconds in 1 round.
./client -sid 1 -nid 1 -master 127.0.0.1 -T 10 -k 1000 -r 1 -c 50 -t 60 &
Replication algorithm in Paxi follows the message passing model, where several message types and their handle function are registered.
-
Define messages, register with gob in
init()
function if using gob codec. -
Define handle function for each message type.
-
Register the messages with their handle function using
Node.Register(interface{}, func())
interface.
For sending messages, use Send(to ID, msg interface{})
, Broadcast(msg interface{})
functions in Node.Socket.
For data-store related functions check db.go file.
For quorum types check quorum.go file.
Client uses a simple RESTful API to submit requests. GET method with URL "http://ip:port/key" will read the value of given key. POST method with URL "http://ip:port/key" and body as the value, will write the value to key.