Fact-checked by Grok 2 weeks ago

Causal consistency

Causal consistency is a in distributed systems that guarantees all processes observe operations in an order that respects their causal dependencies, such that if one operation causally precedes another (e.g., through the same thread of execution, a read depending on a prior write, or ), the latter is always seen after the former across all replicas, while concurrent operations may appear in different orders to different processes. This model strikes a balance between the strict ordering of and the relaxed guarantees of , enabling , low latency, and partition tolerance in geo-replicated environments without requiring global synchronization. The causal order is formally defined by three relations: intra-thread ordering (operations in the same client session), read-from dependencies (a read retrieves a value written by a specific prior write), and (if A precedes B and B precedes C, then A precedes C). Often extended to causal+ consistency, it incorporates convergent for concurrent writes, ensuring replicas eventually agree on outcomes using deterministic merge functions like last-writer-wins, preventing permanent . This makes it particularly suitable for applications like feeds or collaborative editing, where preserving intuitive event sequences (e.g., a post followed by its replies) enhances without sacrificing . Causal consistency gained prominence in the early amid the rise of wide-area storage systems, driven by the CAP theorem's implications that perfect consistency is incompatible with under partitions. Seminal work in the 2011 SOSP paper by Lloyd et al. introduced the COPS key-value store, the first scalable implementation providing causal+ consistency across datacenters by explicitly tracking operation dependencies and enforcing them pessimistically during writes. Building on this, the 2013 NSDI paper by Lloyd et al. presented , extending the model to richer column-family data structures (inspired by ) with efficient dependency tracking on operations rather than versions, supporting non-blocking transactions and achieving near-linear scalability with minimal overhead (under 7% for typical workloads). Subsequent research has explored optimizations, such as bolt-on approaches to retrofit causal consistency onto existing eventually consistent systems via dependency metadata, as in the 2013 SIGMOD paper by Bailis et al., which demonstrates how to achieve it with using shims that propagate causal information without full redesign. Implementations like GentleRain (2014) further advanced it by using version vectors for dependency tracking in partially replicated stores, reducing metadata overhead while maintaining guarantees. Causal consistency is supported in production databases such as (via causal consistency sessions since version 3.6 in 2017) and has been applied to specific features in large-scale systems like Facebook's , though challenges remain in verifying compliance and integrating with external causal signals beyond system operations.

Fundamentals

Definition

Causal consistency is a employed in distributed systems to ensure that all processes perceive causally related operations in the same order, while permitting concurrent operations to appear in varying orders across different processes. Specifically, if one operation causally precedes another—such as a write followed by a dependent read—all processes will observe the write before the read, preserving potential causal dependencies without enforcing for unrelated concurrent events. This approach provides a weaker guarantee than full but stronger than , enabling better performance in geo-replicated environments. Unlike stronger models that impose a global on all operations, causal consistency focuses solely on maintaining "happens-before" relationships, as defined by Lamport's logical clocks, thereby avoiding the overhead of total . This distinction allows systems to tolerate concurrency and partitions while respecting , making it suitable for applications where causal ordering is critical but absolute is not. The model emerged in the amid research on , where early proposals like "slow memory" by Hutto and Ahamad in explored weakening consistency to boost concurrency by prioritizing causal over sequential guarantees. This built upon foundational work on causal ordering in message-passing systems during the late , including contributions by Vijay K. Garg and colleagues on efficient algorithms for maintaining causal relationships in asynchronous environments. In distributed systems prone to network partitions, causal consistency addresses key challenges highlighted by the by favoring availability and partition tolerance over strict , ensuring operations remain responsive even during failures while upholding causal integrity.

Key Properties

Causal consistency is characterized by two primary properties: visibility and ordering, which ensure that causal relationships are preserved across distributed processes while allowing flexibility for independent operations. The visibility property guarantees that all writes eventually become visible to all processes, but the timing of this visibility adheres to causal dependencies derived from the happens-before relation. Specifically, a process cannot observe a write until all causally preceding writes in its dependency chain are also visible, preventing the exposure of incomplete causal histories. The ordering property enforces that if one operation A causally precedes another operation B—meaning A happens-before B according to Lamport's partial order—then every process that observes B will have already observed A, maintaining a consistent sequence for related events across all replicas. This property extends to transitive dependencies, ensuring that the entire causal chain is respected without imposing a global on concurrent operations. A core formal rule underpinning these properties is that if write w1 causally precedes write w2 (denoted w1 → w2), then every process that observes w2 will have observed w1 before w2. This rule, often verified through dependency tracking like vector clocks, ensures the integrity of causal cuts in operation histories. Despite these strengths, causal consistency permits "forks" in observed histories for concurrent, non-dependent events, which can lead to anomalies such as write skew, where two independent writes based on overlapping reads result in an inconsistent aggregate state visible to some processes. This flexibility trades stricter for improved and latency in partitioned environments.

Examples and Illustrations

Basic Example

To illustrate causal consistency in a or shared system, consider a simple scenario involving three users: Alice, , and interacting via a platform. Alice performs a write operation by posting the message "I got the job!" Bob then reads W1 and, in response, performs a causally dependent write operation W2 by commenting "Congrats!" on Alice's post. Concurrently with W1, Charlie performs an independent write operation W3 by posting "Nice weather today!" with no causal relationship to W1 or W2. Under causal consistency, all observers are guaranteed to see before W2, preserving the causal dependency where Bob's action relies on Alice's post. However, since W3 is concurrent and unrelated to , its visibility order relative to and W2 may differ across observers without violating . For instance, an observer near Charlie's location might first see W3 followed by and then W2, while an observer near Bob might see , followed by W2, and then W3. This variation highlights that causal consistency enforces a per-process causal order but permits flexible ordering for independent concurrent operations. Such behavior avoids anomalies like seeing W2 without W1, which would imply Bob's congratulations appear without context from Alice's achievement. Causal consistency thus enables during network partitions, as writes and reads can proceed locally without awaiting global synchronization for concurrent events, while still respecting causal dependencies.

Advanced Scenario

In a distributed collaborative document editing system, consider an advanced scenario involving multiple concurrent operations with dependencies. Suppose the initial document consists of a basic structure, such as placeholder text "ab". User A, operating from one replica, performs write operation W1 by inserting a new paragraph (represented as "1") between "a" and "b", resulting in "a1b". Concurrently, User B from another replica executes write operation W2, inserting an independent paragraph ("2") in the same position, yielding "a2b" locally. Later, User C, after observing the effects of W1 at their replica, performs write operation W3: a merge that inserts a dependent paragraph ("3") between "a" and "1", producing "a31b" and explicitly relying on the presence of W1's content for context, such as referencing the details in paragraph 1, but without any dependency on W2. Causal consistency ensures that the dependency chain is preserved across all s: every observes W1 before W3, maintaining the logical cause-and-effect where C's merge builds directly on A's edit. The position of W2 relative to W1 and W3 can differ between replicas due to concurrent execution and varying paths; for instance, one replica might integrate operations as "a12b" then "a312b", while another sees "a21b" followed by "a231b" before converging. If in a specific path causes W3 to indirectly follow W2 (e.g., through shared ), that additional causal is also enforced, preventing violations of observed dependencies. This model permits temporary divergence, such as a temporarily displaying W2 before due to faster propagation of independent updates, which could briefly disrupt the document's flow for some users. However, eventual —achieved through tracking and dissemination—resolves these discrepancies, ensuring all finalize at the consistent state "a312b" without requiring global locks. In practical applications like collaborative editors, causal consistency supports high-throughput editing by minimizing overhead, allowing thousands of concurrent users to contribute with low latency while preserving intuitive ordering for dependent actions, such as threaded comments or version merges in tools akin to .

Comparisons

With Sequential Consistency

Sequential consistency requires that the results of any execution of a collection of processes be the same as if the operations of all the processes were executed in some sequential order, with the operations of each individual process appearing in that order as specified by the program. In contrast, causal consistency is a weaker model that only enforces a partial order on operations based on causal dependencies, such as those within the same execution thread or where one operation reads a value written by another, allowing concurrent non-causally related operations to be linearized differently across replicas. , however, imposes a single total global order on all operations, regardless of causal relationships, ensuring that every process observes the same sequence. This difference leads to significant trade-offs in distributed environments, particularly geo-replicated systems. Causal consistency improves and reduces by minimizing global coordination, as replicas need only propagate causally dependent updates, avoiding the synchronization overhead required for a . However, it risks anomalies where concurrent writes appear in inconsistent orders to different observers, potentially complicating application logic. Sequential consistency eliminates such issues by guaranteeing a uniform view but at the cost of higher and reduced throughput due to the need for cross-replica barriers or locks. For instance, in a shared incremented concurrently by multiple processes without direct dependencies, sequential consistency ensures all increments are totally ordered, yielding the same final value everywhere. Causal consistency, by comparison, only preserves order for dependent increments (e.g., one reading the prior value), so non-dependent concurrent increments might result in temporarily divergent values across replicas until .

With Linearizability and Eventual Consistency

is a strong consistency model that ensures all operations appear to take effect instantaneously at some point in , preserving both the ordering of non-overlapping operations and the illusion of a single global copy of the data across all replicas. This model requires that concurrent operations be serializable in a way that respects wall-clock time, providing atomicity and a visible to all clients. In contrast, causal consistency does not enforce 's real-time constraints or the single-copy atomicity for all operations, permitting greater concurrency and flexibility at the cost of potential stale reads for non-causally related concurrent updates. While demands coordination across replicas to maintain global ordering, often reducing availability during partitions as per the , causal consistency only orders operations based on causal dependencies, enabling low-latency local reads without inter-replica synchronization for independent operations. This makes causal consistency weaker than but more suitable for highly available systems where strict real-time guarantees are unnecessary. Eventual consistency, a weaker model, guarantees that if no new updates occur, all replicas will eventually converge to the same state, but it provides no ordering guarantees, allowing replicas to temporarily diverge without respecting causal relationships. Causal consistency builds upon eventual consistency by additionally enforcing causal ordering, ensuring that causally related operations (such as a write followed by a dependent read) appear in the correct sequence to prevent anomalies like observing an effect before its cause, while still permitting temporary inconsistencies for unrelated concurrent operations. This enhancement provides stronger safety properties than pure eventual consistency without the overhead of total ordering. Causal consistency occupies a middle ground in the consistency spectrum, offering a balance between the strong guarantees of and the minimal assurances of , as highlighted in extensions to Brewer's like PACELC, which emphasize trade-offs between consistency, availability, and latency even in the absence of partitions.

Formal Aspects

Causal Precedence

Causal precedence in distributed systems is formally defined using the happens-before relation, originally introduced by to capture potential causal dependencies among events. This relation, denoted as →, extends to operations in a distributed setting: for two operations o_1 and o_2, o_1 \rightarrow o_2 if o_1 completes before o_2 starts on the same process (program order), or if o_2 reads a value written by o_1 (read-from dependency), or through a transitive chain of such direct dependencies, including those propagated via inter-process messages (message order). The formal notation captures this as a partial : o_1 \rightarrow o_2 there exists a chain of program-order dependencies (within a ) and message-order dependencies (across via communication or reads). This irreflexive and transitive relation ensures that concurrent operations (neither o_1 \rightarrow o_2 nor o_2 \rightarrow o_1) may be observed in different orders by different processes, but causally linked ones maintain their precedence. In the context of causal consistency, the model enforces that if o_1 \rightarrow o_2, then every P observes the effects of o_1 before those of o_2 in its of reads and writes. This requirement preserves the intuitive notion of without imposing a on all operations. Vector clocks provide a mechanism to track these causal dependencies by assigning each a vector of logical timestamps, one entry per in the , incremented and updated upon local events and message exchanges to reflect potential causal influences. By comparing vector clocks, systems can determine if one operation causally precedes another without relying on synchronized physical clocks.

Session and Convergence Guarantees

In causal consistency, a session refers to a sequence of operations performed by a single client or thread, and the model provides specific guarantees to ensure that these operations appear serialized in a manner that respects causal dependencies. Within a session, the system maintains a consistent view of the causal history, meaning that each read operation observes a state that includes all causally preceding writes from prior operations in the same session, as if the operations were executed in a total order consistent with the happens-before relation. This is supported by four key session guarantees: read-your-writes (ensuring a read sees the effects of a prior write in the same session), monotonic reads (subsequent reads return values at least as recent as previous reads), writes-follow-reads (a write is visible only after all reads that causally precede it), and monotonic writes (writes build upon the causal history seen by prior writes in the session). These guarantees prevent anomalies such as a client observing the effects of its own write followed by an older version in the same session. The session guarantees rely on the causal precedence relation, where operations are ordered if one happens-before another within the session or across causally linked sessions. For instance, if a client writes a value and then reads it in the same session, the read must reflect that write due to program order . Similarly, if a read observes a write from another session that is causally linked, subsequent operations in the current session append to that extended history, preserving monotonicity. Across multiple sessions, causal consistency ensures that if an o in session S_1 causally precedes an o' in session S_2 (i.e., o \rightarrow o'), then S_2 observes the effects of o before executing o', maintaining the causal order globally. For non-causally related operations, such as concurrent writes to the same data item without dependencies, sessions may observe different orders, but the model includes convergence properties to resolve this. In particular, under causal+ consistency (a common strengthening of basic causal consistency), once updates cease, all sessions eventually converge to the same value or set of values through mechanisms like commutative functions applied to conflicting updates. This convergence occurs post-partition or after propagation delays, ensuring the global state stabilizes without requiring total ordering of unrelated operations. For example, two concurrent writes to a might be resolved using a last-writer-wins or a merge , with all replicas agreeing on the outcome after applying the handler. However, basic causal consistency does not guarantee fork-consistency, where forks (divergent views from concurrent non-causal operations) must eventually join in the same order across all sessions; this limitation can lead to different sessions perceiving merged states differently until full propagation. Extensions such as fork-join causal consistency address this by enforcing consistent join orders despite faults or .

Implementations and Applications

Core Techniques

Dependency tracking is a foundational for achieving causal consistency, where operations are tagged with representing their causal histories to ensure that dependent writes are propagated and observed in the correct order. This is commonly implemented using version vectors, which associate each write operation with a vector of counters, one per or , incremented upon updates to capture potential causal dependencies. For more efficient tracking in systems with high concurrency, dotted version vectors extend traditional version vectors by assigning each update a unique "dot" identifier—a pair of node ID and sequence number—allowing precise detection of causal relationships and concurrency without excessive growth. These structures enable replicas to compare histories and determine if one operation causally precedes another by checking vector dominance or dot inclusion, forming the basis for formal causal precedence in distributed execution traces. In partitioned systems, propagation mechanisms ensure that causal dependencies are respected across replicas through asynchronous of updates. Gossip protocols facilitate this by having nodes periodically exchange summaries of their local histories, such as version vectors or dependency sets, to identify missing causally related operations and pull them selectively. Anti-entropy mechanisms complement this by using structures like Merkle trees to compute and reconcile differences in replica states, detecting divergences in causal histories and merging them while enforcing precedence orders to avoid violations. These approaches allow updates to flow decentralizedly, merging histories only when necessary to maintain in geo-distributed environments. Handling concurrency in causal consistency often relies on optimistic replication, where write operations are accepted and executed locally without immediate global coordination to minimize . During subsequent with other replicas, the causal validity of the write is checked against the propagated dependency metadata; if a violation is detected—such as a dependent read observing an inconsistent history—the operation may be rolled back or resolved via application-specific conflict handlers. This technique balances and performance by deferring consistency checks, ensuring that concurrent but non-causal writes can proceed independently while causally linked ones are ordered correctly upon merge. To scale without a central coordinator, decentralized clocks approximate using hybrid logical clocks (HLCs), which combine physical wall-clock time with logical counters to timestamp . An HLC at a maintains a pair (physical time, logical counter), updating the physical component to the maximum observed time across messages and incrementing the logical counter for local to capture happens-before relations. This enables ordering of operations consistent with —where if A causally precedes B, then HLC(A) < HLC(B)—while keeping timestamps close to , avoiding the overhead of pure logical clocks like Lamport timestamps in large-scale deployments. A key challenge in geo-replication is managing from wide-area networks, addressed through causal buffering that delays only operations dependent on remote writes. Buffers hold local writes until their causal predecessors arrive from other partitions, allowing non-dependent operations to proceed immediately and reducing perceived for workloads. This selective delaying ensures causal without blocking unrelated concurrency, achieving low tail latencies even under partitions or high RTTs (e.g., 100-200 ms across continents).

Real-World Systems

supports causal consistency through client sessions that enable causally consistent reads and writes, utilizing session tokens to track operation dependencies. This feature was introduced in version 3.6, released in November 2017. provides serializable transactions with external consistency, leveraging hybrid logical clocks to order transactions in geo-distributed environments and ensure causal dependencies are preserved across replicas. In social media applications, causal consistency approximates the required ordering for dependent actions, such as ensuring replies and appear after the original post in user timelines, as explored in protocols for convergent causal consistency tailored to posts. Similarly, collaborative tools like employ techniques that preserve causal relationships in edit propagation, maintaining the order of dependent changes across concurrent users to avoid anomalies in document evolution. As of 2025, cloud services have extended support for causal querying; for instance, AWS DynamoDB streams facilitate that can be processed to enforce causal ordering in downstream applications. Ongoing research explores weaker models like PRAM (probabilistic read atomicity monotonicity), which offer probabilistic guarantees on write visibility to balance availability and performance, though they do not provide full causal ordering. A 2025 survey highlights ongoing advancements in causally consistent cloud systems, including scalable geo-replicated stores that avoid latency cascades. In practice, causal consistency enables low-latency and highly available systems under the CAP theorem's partition tolerance, where preserving causal order minimizes user-perceived inconsistencies without requiring full .

References

  1. [1]
    [PDF] Scalable Causal Consistency for Wide-Area Storage with COPS
    Sep 6, 2011 · In this paper, we consider causal consistency with convergent conflict handling, which we refer to as causal+ consistency. Many previous.
  2. [2]
    [PDF] A Short Primer on Causal Consistency - USENIX
    In this article, we suggest causal consistency repre- sents an excellent point in this tradeoff space; it is compatible with strong performance and liveness ...
  3. [3]
    [PDF] Stronger Semantics for Low-Latency Geo-Replicated Storage
    Sep 2, 2012 · 3.1 Achieving Causal Consistency. Eiger provides causal consistency by explicitly check- ing that an operation's nearest dependencies have ...
  4. [4]
    [PDF] Bolt-on Causal Consistency - Peter Bailis
    Apr 22, 2013 · In this paper, we make the following contributions: • We describe a system architecture for achieving convergent causal consistency by applying ...
  5. [5]
    Causal memory: definitions, implementation, and programming
    Hutto PW, Ahamad M: Slow memory: weakening consistency to enhance concurrency in distributed shared memories. In: Proc 10th International Conference on ...
  6. [6]
    Slow memory: weakening consistency to enhance concurrency in ...
    Slow memory: weakening consistency to enhance concurrency in distributed shared memories. Abstract: The use of weakly consistent memories in distributed shared ...
  7. [7]
    [PDF] A Non-blocking Recovery Algorithm for Causal Message Logging
    Causal message logging sends message receive ordering information with each message. This in- formation includes receives and their causal history since the ...
  8. [8]
    [PDF] The Potential Dangers of Causal Consistency and an Explicit Solution
    Sep 30, 2012 · ABSTRACT. Causal consistency is the strongest consistency model that is available in the presence of partitions and provides useful se-.
  9. [9]
    Causal Consistency - Jepsen
    Convergent causal systems require that the values of objects in the system converge to identical values, once the same operations are visible. In such a system ...
  10. [10]
  11. [11]
  12. [12]
    [PDF] Principles of Eventual Consistency - Microsoft
    Causal Consistency. 57 tion order (indicated by numeric subscripts representing timestamps) orders Bob's reply before Alice's question, so Charlie sees them in ...
  13. [13]
    What is causal consistency in distributed systems? - Educative.io
    Causal consistency ensures all processes see causally related operations in the same order, allowing different orders for concurrent operations in ...
  14. [14]
    [PDF] Data Consistency for P2P Collaborative Editing - Hal-Inria
    Nov 6, 2006 · Such systems cannot scale when deployed on P2P networks. In this paper, we propose a new model for building a collaborative editing system. This.
  15. [15]
    Linearizability: a correctness condition for concurrent objects
    Linearizability is a correctness condition for concurrent objects that exploits the semantics of abstract data types. It permits a high degree of concurrency, ...
  16. [16]
    [PDF] Dynamo: Amazon's Highly Available Key-value Store
    Dynamo provides eventual consistency, which allows for updates to be propagated to all replicas asynchronously. A put() call may return to its caller before ...
  17. [17]
    [PDF] Consistency Tradeoffs in Modern Distributed Database System Design
    A proposed new formulation, PACELC, unifies this tradeoff with CAP. Daniel J. Abadi, Yale University. Consistency. Tradeoffs in. Modern Distributed. Database ...
  18. [18]
    [PDF] Time, Clocks, and the Ordering of Events in a Distributed System
    In this paper, we discuss the partial ordering defined by the "happened before" relation, and give a distributed algorithm for extending it to a consistent ...
  19. [19]
    [PDF] Virtual time and global states of distributed systems
    Abstract. A distributed system can be characterized by the fact that the global state is distributed and that a common time base does not exist.
  20. [20]
    Session guarantees for weakly consistent replicated data
    Session guarantees for weakly consistent replicated data. Abstract: Four per-session guarantees are proposed to aid users and applications of weakly consistent ...
  21. [21]
    [PDF] Scalable Causal Consistency for Wide-Area Storage with COPS
    The regular version,. COPS, provides scalable causal+ consistency between individual items in the data store, even if their causal dependencies are spread.
  22. [22]
    [PDF] Dotted Version Vectors: Efficient Causality Tracking for Distributed ...
    We have introduced dotted version vectors, a novel solution for tracking causal dependencies among update events. The base idea of our solution is to add ...
  23. [23]
  24. [24]
    [PDF] Logical Physical Clocks and Consistent Snapshots in Globally ...
    We present a logical clock version of HT, which we name as Hybrid Logical Clocks (HLC). HLC refines both the physical clock (similar to PT and TT) and the ...Missing: decentralized | Show results with:decentralized
  25. [25]
    [PDF] Causal Consistency and Latency Optimality - arXiv
    Mar 12, 2018 · ABSTRACT. Causal consistency is an attractive consistency model for replicated data stores. It is provably the strongest model.
  26. [26]
    Causal Consistency and Read and Write Concerns - MongoDB
    With MongoDB's causally consistent client sessions, different combinations of read and write concerns provide different causal consistency guarantees.
  27. [27]
    MongoDB Software Lifecycle Schedules
    MongoDB Server ; MongoDB 3.6, November 2017, April 30, 2021 ; MongoDB 3.4, November 2016, January 31, 2020 ; MongoDB 3.2, December 2015, September 30, 2018.
  28. [28]
    CockroachDB's consistency model
    Feb 23, 2021 · CockroachDB provides a high level of “consistency”, second only to Spanner among distributed databases as far as I know.note on clocks · CockroachDB's consistency... · CockroachDB does not offer...
  29. [29]
    CockroachDB beta-20160829 - Jepsen
    Feb 16, 2017 · CockroachDB is a distributed, scale-out SQL database which relies on hybrid logical clocks to provide serializability, given semi-synchronized node clocks.
  30. [30]
    Convergent Causal Consistency for Social Media Posts
    Apr 26, 2021 · This paper presents a causal+ consistency protocol, CaDRoP, to ... Convergent Causal Consistency for Social Media Posts. Computing ...
  31. [31]
    [PDF] Operational transformation in cooperative software systems
    Maintaining data consistency, transaction causality, and replication convergence in such an environment, while providing fast client responsiveness, is a ...
  32. [32]
    Change data capture for DynamoDB Streams - AWS Documentation
    DynamoDB Streams captures a time-ordered sequence of item-level modifications in any DynamoDB table and stores this information in a log for up to 24 hours.AWS Lambda triggers · IAM policy to allow an AWS... · Java exampleMissing: causal | Show results with:causal
  33. [33]
    PRAM - Jepsen
    PRAM is exactly equivalent to read your writes, monotonic writes, and monotonic reads. PRAM is sticky available: in the event of a network partition, all ...
  34. [34]
    Don't settle for eventual: scalable causal consistency for wide-area ...
    We present the design and implementation of COPS, a key-value store that delivers this consistency model across the wide-area. A key contribution of COPS is its ...