Causal Consistency and Latency Optimality: Friend or Foe?

Diego Didona, Rachid Guerraoui, Jingjing Wang, Willy Zwaenepoel

Abstract

Causal consistency is an attractive consistency model for replicated data stores. It is provably the strongest model that tolerates partitions, it avoids the long latencies associated with strong consistency, and, especially when using read-only transactions, it prevents many of the anomalies of weaker consistency models. Recent work has shown that causal consistency allows "latency-optimal" read-only transactions, that are nonblocking, single-version and single-round in terms of communication. On the surface, this latency optimality is very appealing, as the vast majority of applications are assumed to have read-dominated workloads. In this paper, we show that such "latency-optimal" read-only transactions induce an extra overhead on writes, the extra overhead is so high that performance is actually jeopardized, even in read-dominated workloads. We show this result from a practical and a theoretical angle. First, we present a protocol that implements "almost latency-optimal" ROTs but does not impose on the writes any of the overhead of latency-optimal protocols. In this protocol, ROTs are nonblocking, one version and can be configured to use either two or one and a half rounds of client-server communication. We experimentally show that this protocol not only provides better throughput, as expected, but also surprisingly better latencies for all but the lowest loads and most read-heavy workloads. Then, we prove that the extra overhead imposed on writes by latency-optimal read-only transactions is inherent, i.e., it is not an artifact of the design we consider, and cannot be avoided by any implementation of latency-optimal read-only transactions. We show in particular that this overhead grows linearly with the number of clients.

1. Introduction

In the landscape of geo-replicated databases, Causal Consistency (CC) has emerged as a preferred model, offering a balance between the performance of eventual consistency and the strictness of serializability. A significant focus in recent research has been the optimization of Read-Only Transactions (ROTs). Systems like COPS-SNOW have achieved "latency optimality" (LO), where reads are non-blocking, require only a single round of communication, and return a single version of each key. While theoretically appealing for read-heavy workloads, this paper demonstrates that the pursuit of LO reads introduces a substantial and unavoidable "tax" on write operations.

2. The Hidden Cost of Latency Optimality

The primary drawback of LO protocols is the complexity they shift to the write path. To maintain causal consistency without blocking reads, these systems must implement a "Readers Check." This mechanism requires writes to track and verify which transactions are currently reading older data versions to prevent consistency violations.

The "Readers Check" mechanism in latency-optimal protocols imposes significant overhead on write operations.

As illustrated in Figure 2, this check consumes significant CPU and network resources. The authors provide a formal proof that this overhead is inherent: any protocol achieving LO must exchange metadata that grows linearly with the number of clients. In practice, this means that as a system scales, the "fast" reads are eventually slowed down by queuing delays caused by the increasingly expensive writes.

3. The Contrarian Protocol

To circumvent these limitations, the authors introduce Contrarian, a protocol that intentionally sacrifices the single-round read requirement to eliminate the write-side overhead. Contrarian utilizes Hybrid Logical Clocks (HLC) to ensure reads remain non-blocking and single-versioned, but it employs a coordinator-based approach requiring either 1.5 or 2 rounds of communication.

Contrarian utilizes (a) 1.5 rounds or (b) 2 rounds of communication to avoid the write-side overhead of latency-optimal designs.

By allowing an extra "half-round" (a hop from a coordinator to partitions), as shown in Figure 6, Contrarian avoids the need for writes to track readers. This design choice leads to significantly better resource utilization and overall system stability under load.

4. Evaluation and Results

The authors evaluated Contrarian against a latency-optimal baseline (CC-LO) using the Yahoo! Cloud Serving Benchmark (YCSB). The results challenge the conventional wisdom regarding LO reads:

  • Throughput: Contrarian achieved up to 2.35x higher throughput than the LO design in multi-datacenter scenarios.
  • Latency: While CC-LO is slightly faster under near-idle conditions, Contrarian provides lower average and tail (99th percentile) latencies as soon as the system faces significant traffic. The expensive writes in LO systems create resource contention that ultimately penalizes the reads they were meant to optimize.
  • Scalability: Experimental data confirmed the theoretical linear growth of metadata in LO systems, whereas Contrarian's metadata overhead remains constant regardless of the number of clients.

5. Conclusion

While latency-optimal read-only transactions are a significant theoretical milestone, they are often a "foe" in practical, high-performance distributed systems. By accepting a slightly higher theoretical read latency, the Contrarian protocol achieves superior throughput and lower tail latencies in realistic workloads. This work highlights that in distributed consistency, optimizing for one operation in isolation can lead to systemic performance degradation.

Summary updated

BibTeX
@article{didona2018causal,
  author = {Diego Didona and Rachid Guerraoui and Jingjing Wang and Willy Zwaenepoel},
  title = {{Causal Consistency and Latency Optimality: Friend or Foe?}},
  journal = {Proc. VLDB Endow.},
  year = {2018},
  url = {https://openreview.net/forum?id=yqF4NNsMHZ},
}
Figure