This paper, published in 2011 by researchers from IBM and LinkedIn, introduces Spinnaker, an experimental distributed datastore that challenges the long-held belief that you must choose between strong consistency and high performance.
TL;DR
Spinnaker is a distributed datastore that uses a Paxos-based replication protocol to provide strong consistency and high availability without the typical performance penalties. By integrating Paxos directly into its storage engine, Spinnaker achieves read speeds 1.5x–3x faster than Cassandra’s quorum reads while remaining within 5–10% of its write performance.
What Problem Does This Paper Address?
In the world of distributed databases, the CAP Theorem suggests a fundamental trade-off between Consistency, Availability, and Partition Tolerance. Traditionally, systems like Amazon’s Dynamo or Apache Cassandra chose "Eventual Consistency" to maintain high availability and performance. However, eventual consistency is notoriously difficult for developers to reason about, often leading to subtle bugs during conflict resolution.
On the other hand, "Strong Consistency" was often achieved through master-slave replication or Two-Phase Commit (2PC). Master-slave replication has "blind spots" where a single node failure can make the database unavailable or cause data loss. Paxos, the gold-standard algorithm for distributed consensus, provides a solution but was historically dismissed by the database community as being too complex and too slow for high-throughput transactional workloads.
Methods
The authors built Spinnaker to prove that Paxos can be both simple and fast. Key architectural choices include:
- Paxos-Integrated Logging: Unlike systems that layer Paxos on top of a database, Spinnaker integrates the protocol directly into its commit log and recovery process.
- Cohort-Based Replication: Data is range-partitioned across the cluster. Each range is managed by a "cohort" (typically 3 nodes). One node acts as the leader, and the others are followers.
- Optimized Quorum Writes: For a write to succeed, the leader only needs an acknowledgment from one follower (forming a majority of 2 out of 3). This "Multi-Paxos" approach reduces the critical path to a single network round-trip and a disk force.
- ZooKeeper Coordination: Spinnaker offloads the "heavy lifting" of leader election and cluster membership to Apache ZooKeeper. This keeps the complex state-machine logic out of the high-frequency read/write paths.
- Logical Log Truncation: To handle recovery when multiple data partitions share a single physical log, the authors developed a "logical truncation" method using "skipped LSN (Log Sequence Number) lists" to ensure data integrity without physical log mangling.
Datasets
The authors evaluated Spinnaker using a custom benchmarking suite on two environments:
- Local Cluster: 10 nodes with quad-core AMD processors, 16GB RAM, and SATA disks (with some tests using FusionIO SSDs).
- Amazon EC2: Clusters of 20, 40, and 80 "Standard Extra Large" instances to test horizontal scalability.
They compared Spinnaker's performance directly against Apache Cassandra (the trunk version as of October 2009), which served as a baseline for an eventually consistent system.
Key Insights and Ideas
- The "Strong Read" Paradox: Counter-intuitively, strong consistency can be faster than weak consistency. In Cassandra, a "quorum read" must contact multiple replicas to check for conflicts. In Spinnaker, a "consistent read" only needs to talk to the leader, because the leader is the guaranteed source of truth.
- Paxos is a Recovery Tool: The authors treat Paxos not just as a replication protocol, but as the core of the recovery engine. This ensures that a data partition remains available as long as a majority of replicas are alive, regardless of the failure sequence.
- SSDs Level the Playing Field: The performance bottleneck in distributed databases is often disk I/O for logging. The authors found that moving the log to an SSD improved write latency to ~6ms, making the overhead of Paxos consensus negligible compared to the benefits of consistency.
Key Results
- Read Performance: Spinnaker’s strongly consistent reads were 1.5x to 3x faster than Cassandra’s quorum reads. Its "timeline" (potentially stale) reads were identical in speed to Cassandra’s weak reads.
- Write Performance: Spinnaker was only 5% to 10% slower than Cassandra’s quorum writes, a small price to pay for the move from eventual to strong consistency.
- Recovery Time: Thanks to the ZooKeeper integration and the Paxos-based leader takeover, a failed cohort could recover and become available for writes in less than 0.5 seconds (assuming a 1-second commit period).
- Linear Scalability: Tests on EC2 showed that write latency remained constant as the cluster size increased from 20 to 80 nodes, proving the architecture scales horizontally.
Limitations and Future Work
- Single-Operation Transactions: At the time of writing, Spinnaker only supported single-row operations (get/put). The authors suggest that multi-operation transactions could be added by batching log records at commit time, but this was not implemented.
- Single Datacenter Focus: Spinnaker was designed for a single datacenter. The authors acknowledge that cross-datacenter replication would likely require a different, perhaps asynchronous, strategy.
- Primitive Log Manager: The authors noted that their log manager (inherited from Cassandra) was relatively simple. They speculated that a more sophisticated log manager (using async I/O and preallocated files) could further improve absolute performance.
Summary updated