Abstract
General solutions of state machine replication have to ensure that all replicas apply the same commands in the same order, even in the presence of failures. Such strict ordering incurs high synchronization costs due to the use of distributed consensus or a leader. This paper presents a protocol for linearizable state machine replication of conflict-free replicated data types (CRDTs) that neither requires consensus nor a leader. By leveraging the properties of state-based CRDTs—in particular the monotonic growth of a join semilattice—synchronization overhead is greatly reduced. In addition, updates just need a single round trip and modify the state 'in-place' without the need for a log. Furthermore, the message size overhead for coordination consists of a single counter per message. While reads in the presence of concurrent updates are not wait-free without a coordinator, we show that more than 97% of reads can be handled in one or two round trips under highly concurrent accesses. Our protocol achieves high throughput without auxiliary processes such as command log management or leader election. It is well suited for all practical scenarios that need linearizable access on CRDT data on a fine-granular scale.
Introduction
In distributed systems, engineers often face a stark trade-off between consistency and performance. Traditional Replicated State Machines (RSMs), powered by protocols like Raft or Paxos, provide linearizability—the gold standard of consistency. However, these protocols are often "heavy," requiring a central leader that can become a bottleneck and maintaining an ever-growing command log that necessitates complex truncation and snapshotting.
Conversely, Conflict-free Replicated Data Types (CRDTs) offer leaderless, highly available updates but typically only guarantee Strong Eventual Consistency (SEC). While SEC ensures replicas eventually converge, it allows for temporary inconsistencies that are unacceptable for applications requiring strict atomicity, such as financial ledgers or global counters. This paper bridges this gap by introducing a protocol that provides linearizable replication for state-based CRDTs without the overhead of traditional consensus.
Protocol Design: Leveraging Lattices
The core innovation of this protocol is its use of Generalized Lattice Agreement (GLA). By assuming the data is a state-based CRDT, the system treats the state as a "join semilattice" where values only move "up" or grow monotonically.
As shown in the figure above, a Grow-only Counter (G-counter) is defined by its compare and merge functions. The compare function ensures a partial ordering, while the merge function computes the least upper bound (LUB) of two states. Because CRDT states are monotonic, the system does not need to agree on the exact order of every command; it only needs to agree on the current maximum state in the lattice. This insight drastically reduces coordination overhead.
Leaderless and Logless Operation
Unlike Raft, any node in this protocol can act as a "proposer." There is no leader election, ensuring the system remains available as long as a majority of nodes can communicate. Furthermore, the protocol eliminates the command log entirely. Updates are applied "in-place" using the LUB merge operation, removing the need for log management and truncation—one of the most error-prone aspects of traditional RSM implementations.
To ensure linearizability, the protocol employs a modified two-phase approach (Prepare and Vote) for queries. A "consistent quorum" optimization allows a proposer to skip the second phase if it receives the same state from a majority of nodes during the first phase, significantly reducing latency.
Performance Evaluation
The protocol was evaluated using a custom implementation in Scalaris, an Erlang-based distributed key-value store, and benchmarked against standard Multi-Paxos and Raft implementations using basho_bench.
Key findings include:
- Throughput: In query-heavy workloads (90% queries), the CRDT-based protocol significantly outperformed both Raft and Multi-Paxos due to the lack of a leader bottleneck.
- Latency: Under high concurrency, 99% of queries were completed in just one to three round trips. Updates consistently finished in a single round trip.
- Resilience: The system maintained availability during node failures without the "downtime" associated with leader elections in traditional systems.
- Efficiency: Coordination overhead is minimal, requiring only a single counter per message to track rounds.
Discussion and Future Work
While the protocol offers significant advantages, it faces challenges under extreme query contention. If there is a constant stream of concurrent updates, queries may be delayed. While batching mitigates this in most practical scenarios, future work could explore "leader oracles" for extreme cases. Additionally, while state-based CRDTs can suffer from "state inflation" (e.g., due to tombstones), the authors suggest delta-mutators as a potential solution. Currently, the protocol supports write-only updates and read-only queries; extending this to support atomic read-modify-write operations remains an area for further research.
Summary updated