Skip to main content
← CONCEPTS / DATA ENGINEERING
An end-to-end domain learning journey

Chandy-Lamport Global Snapshots
& Consistent Cuts.

Chandy-Lamport injects special Marker messages onto FIFO channels so every node snapshots local state on its first Marker and records in-flight messages on remaining channels until their Markers arrive.
Start the journey5 sections· Last modified Nov 27, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When checkpointing distributed pipelines without global pauses, use Chandy-Lamport FIFO Markers (or Flink-style aligned/unaligned barriers) to guarantee a Consistent Cut.

TL;DR30-second simplified summary
▾

Snapshotting local state on the first Marker and logging other FIFO channels until their Markers arrive guarantees causal consistency—forming the basis for Flink's barrier snapshots.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Happens-Before & Logical Clocks
Know Lamport's causal ordering (a -> b): an effect cannot appear in a snapshot without its cause.
FIFO Point-to-Point Channels
Understand that TCP-style FIFO channels guarantee messages sent before a Marker arrive before that Marker.
Full walkthrough · 5 stages
01
L4 · FUNDAMENTALS

P · Problem & Why Unsynchronized Backups Lose or Duplicate State.

Imagine two accounts: Node A starts with $100, Node B starts with $0. Node A sends a $50 transfer message to Node B.

If Node A checkpoints after deducting $50 (saving $50) while Node B checkpoints before the message arrives (saving $0), the global backup only totals $50—$50 disappeared into the network! Worse, if Node A checkpoints before sending ($100) and Node B checkpoints after receiving ($50), the backup totals $150—an impossible global state called an Inconsistent Cut.

Global Cut Consistency

Unsynchronized Wall-Clock Backup vs. Chandy-Lamport Consistent Cut

Before · Unsynchronized Backups
  • $50 lost or duplicated in transit
  • Inconsistent Cut (effect without cause)
  • Requires stop-the-world pause to fix
After · Chandy-Lamport Marker Cut
  • Captures node state + channel state
  • Zero stop-the-world cluster pause
  • Preserves exact $100 conservation
02
L4 · FUNDAMENTALS

R · Representation: The Two Chandy-Lamport Marker Rules.

A Marker(snapshot_id) is a lightweight control message sent over the exact same FIFO channels as normal data messages—it can never overtake data sent before it.

Initiator Rule: Record local state S_i, mark all incoming channels as recording, and immediately send Marker on all outgoing channels. Receiver Rule: When Marker arrives on channel c_k: if this is the node's first Marker for snapshot_id, record local state S_j, mark c_k as empty (done), start recording all other incoming channels, and send Marker on all outgoing channels. If already snapshotted, simply stop recording c_k.

Marker Propagation

Node A Snapshots & Sends Marker -> Node B Snapshots -> Channel 2 Records In-Flight

Initiator AFIFO Ch 1FIFO Ch 2Receiver B1. Save S_A; send Marker(42) onCh12. Msg1 in flight before Marker onCh23. First Marker -> Save S_B;record Ch24. Msg1 recorded; Marker stops Ch2
03
L5 · APPLIED DESIGN

I · Invariant: Why Every Cut Is Causally Consistent.

A global cut is consistent if for every event e2 included in the cut, every causal predecessor e1 -> e2 is also included.

Suppose Node B receives message m before Node B snapshots S_B. Could Node A have snapshotted S_A before sending m? Impossible! If A snapshotted before sending m, A sent Marker before m on the FIFO channel—so B would have received Marker (and snapshotted S_B) before m arrived!

Channel Recording State

Idle -> First Marker (Snapshot + Record Others) -> All Markers Received -> Done

1st Marker arrivesData on open channelLast Marker arrivesNormal ProcessingRecording OtherChannelsGlobal Cut Ready
04
L5 · APPLIED DESIGN

M · Mechanics at Scale: From Chandy-Lamport to Flink Barriers.

In a streaming DAG (like Apache Flink), operators don't want to persist bulky in-flight channel buffers if they don't have to.

In Aligned Barrier Snapshotting, when an operator receives Barrier N on Channel 1 while Channel 2 is still behind, it temporarily blocks (buffers) Channel 1 in RAM and keeps draining Channel 2 until Barrier N arrives on Channel 2—then snapshots local state with zero channel messages!

DAG Adaptation

Aligned Barriers (Zero Channel State) vs. Unaligned (Chandy-Lamport)

Source Barrier NingressAligned OperatorcomputeUnaligned FallbackcontrolSnapshot Store (S3)storagenormal flowalignment > timeoutstate + in-flightbuffers
Engineering Decision Framework
Problem
How to checkpoint a distributed stateful pipeline without stopping event ingestion.
Naive Solution
Pause all sources globally (stop-the-world) until all queues drain, then backup.
Why It Fails
Global pauses spike tail latency and waste cluster throughput on every checkpoint interval.
Alternatives
Stop-the-world vs. Aligned Barrier Checkpoints vs. Unaligned Chandy-Lamport Snapshots.
Engineering Decision
Use Aligned Barrier Checkpoints for low-backpressure DAGs (minimal snapshot size) and fall back to Unaligned Chandy-Lamport snapshots when alignment time exceeds a threshold.
Trade-Offs
Unaligned snapshots eliminate backpressure stalls at the cost of persisting in-flight network buffers in S3.
05
L6 · SCALE & TRADE-OFFS

E · Edge Cases, Assumptions & When NOT to Use Chandy-Lamport.

Chandy-Lamport relies on two hard assumptions: (1) strongly connected directed graph (every node is reachable from the initiator), and (2) reliable FIFO channels.

When NOT to use Chandy-Lamport: over unordered UDP or multi-path networks where a Marker can overtake an earlier data packet! If a Marker arrives before a pre-snapshot message, that message is wrongly excluded from the cut—use Lai-Yang (piggybacked 1-bit color flags on every message) for non-FIFO networks instead.

Channel & Protocol Fit

TCP/FIFO (Chandy-Lamport) vs. Non-FIFO (Lai-Yang) vs. Backpressured DAG

FIFO Channels (TCP)Chandy-Lamport MarkersNon-FIFO (UDP)Use Lai-Yang ColoringStreaming DAGAligned + Unaligned
Decision Exercise · Make the Call

An engineer implements Chandy-Lamport Marker snapshots over raw UDP sockets (without sequence numbers or reordering). Occasionally, snapshots lose in-flight messages. Why?

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

In the Chandy-Lamport algorithm, what does a receiver node do the FIRST time it receives a `Marker` on incoming channel `c_1`?

Recommended Learning Flow