Skip to content
EasonLiao edited this page Sep 17, 2014 · 7 revisions

Jzab

Jzab is an implementation of ZooKeeper Atomic Broadcast protocol in Java.

What is Zab

Zab stands for ZooKeeper Atomic Broadcast. It's the protocol used by ZooKeeper for transaction replication. It has similar goals with other replication protocols like Paxos, Raft, their goals are replicating transaction to a cluster of servers consistently.

Zab has some unique properties/requirements :

  • Zab guarantees primary order, which means the transactions will be delivered/committed in the same order as the transactions are proposed. It requires a 'prefix-complete' network where receiving message i implies that you have already received messages 0 to i-1.

  • Zab requires the transaction to be idempotent, which means applying the same transactions multiple times won't affect the consistency of the state machine.

For the details of Zab, you can read the paper "Zab: High-performance broadcast for primary-backup systems"

Why do we consider Zab has high performance

The two unique properties/requirements allow some interesting optimizations for the implementation. We consider Zab has high performance mainly for two reasons :

  • Zab allows multiple outstanding transactions. Zab also has 'prefix-complete' network requirement, which allows us batch several transactions with just one acknowledgement.

  • Zab does Fuzzy Snapshot

Jzab

Zab implementation of ZooKeeper is tightly coupled with ZooKeeper code base, it's impossible for other application to use it. That's why we implement Jzab, a Java library which enables people build their own application on top of Zab easily. For 0.1.0 release, we support :

  • Dynamic configuration.
  • Snapshot.

Benchmark

We ran the benchmark on a cluster of 3 servers and each server is running on its own machine with normal hard disk. Each transaction has size of 128 bytes.

Throughput :

We can see the throughput is around 22000 transactions per second. During the snapshot the throughput drops down to around 15000 transactions per second. Since Zab does fuzzy snapshot, it won't suspend the service during snapshot.

Clone this wiki locally