Using Paxos to Build a Scalable, Consistent, and Highly Available Datastore

Jun Rao, Eugene J. Shekita, Sandeep Tata

Abstract: Spinnaker is an experimental distributed datastore designed to provide strong consistency and high availability without the performance penalties typically associated with consensus-based systems. By integrating a Paxos-based replication protocol directly into its storage engine, Spinnaker achieves read speeds 1.5x–3x faster than Cassandra’s quorum reads while maintaining write performance within 5–10% of Cassandra's eventually consistent baseline. This paper demonstrates that strong consistency can be both performant and scalable in distributed environments.

Introduction

In distributed systems, the CAP Theorem traditionally forces a choice between Consistency, Availability, and Partition Tolerance. Many modern systems, such as Apache Cassandra, prioritize availability and performance by adopting "Eventual Consistency." However, this model introduces complexity for developers who must handle conflict resolution and stale data.

Strong consistency has historically relied on master-slave replication or Two-Phase Commit (2PC), both of which have significant drawbacks regarding availability and latency. While Paxos is the gold standard for consensus, it was long considered too complex and slow for high-throughput workloads. Spinnaker was developed to challenge this assumption.

System Architecture and Methods

Spinnaker integrates Paxos directly into its commit log and recovery process rather than layering it on top of an existing database. The system uses a cohort-based replication model where data is range-partitioned across the cluster. Each range is managed by a cohort (typically three nodes) consisting of one leader and multiple followers.

Optimized Paxos Replication

To minimize latency, Spinnaker employs a "Multi-Paxos" approach for writes. As shown in the protocol diagram below, a write only requires an acknowledgment from a majority (one follower in a three-node cohort) before returning to the client. This reduces the critical path to a single network round-trip and a disk force.

Spinnaker's Paxos-based replication protocol for write operations.

Key architectural features include:

  • ZooKeeper Coordination: Offloads leader election and cluster membership to Apache ZooKeeper, keeping the high-frequency data path lean.
  • Logical Log Truncation: A novel recovery method using "skipped LSN lists" allows multiple data partitions to share a single physical log without compromising integrity.
  • Consistent Reads: Unlike Cassandra, which must contact multiple replicas for a quorum read, Spinnaker's leader is the guaranteed source of truth, allowing consistent reads to be served by a single node.

Performance Evaluation

The researchers evaluated Spinnaker against Apache Cassandra on a 10-node local cluster and scaled up to 80 nodes on Amazon EC2.

Key Results

  • Read Performance: Spinnaker’s strongly consistent reads were 1.5x to 3x faster than Cassandra’s quorum reads because they only required communication with the leader.
  • Write Latency: As illustrated in the performance benchmarks, Spinnaker's write latency remains competitive with Cassandra's quorum writes, typically within a 5–10% margin despite the added overhead of Paxos consensus.
Write latency comparison between Spinnaker and Cassandra Quorum writes across varying loads.
  • Rapid Recovery: By leveraging ZooKeeper and Paxos, a failed cohort can recover and elect a new leader in less than 0.5 seconds, ensuring high availability even during node failures.
  • Horizontal Scalability: Tests on EC2 confirmed that write latency remained constant as the cluster size increased, proving the architecture's ability to scale linearly.

Discussion and Limitations

Spinnaker proves that the performance gap between strong and eventual consistency is narrower than previously thought. The use of SSDs further levels the playing field by making the disk I/O for logging—the primary bottleneck—negligible compared to the benefits of consistency.

However, the current implementation has limitations. It supports only single-row operations, and the protocol was designed primarily for single-datacenter environments. Future work could involve extending the system to support multi-operation transactions and cross-datacenter replication strategies.

Summary updated

BibTeX
@article{rao2011using,
  author = {Jun Rao and Eugene J. Shekita and Sandeep Tata},
  title = {{Using Paxos to Build a Scalable, Consistent, and Highly Available Datastore}},
  journal = {PVLDB},
  year = {2011},
  doi = {10.14778/1938545.1938549},
}
Figure