← The Books

Knowing When to Wait

Which problems can a distributed system solve consistently without machines ever waiting to coordinate with one another, and which problems provably force them to wait?

We find out at the oracle at the fork of Paxos, which tells groups of students whether the work they mean to do together lets them live as scholars or makes them live as legislators.

We find out by sorting programs by their logical shape: those that only ever add to their output can run on a group of machines without waiting for one another, and those that rest on an absence cannot.

After Joseph M. Hellerstein, The Declarative Imperative: Experiences and Conjectures in Distributed Logic, 2010 · Tom J. Ameloot, Frank Neven and Jan Van den Bussche, Relational Transducers for Declarative Networking, 2011 · Joseph M. Hellerstein and Peter Alvaro, Keeping CALM: When Distributed Consistency Is Easy, 2020

From the oracle's north gateway, under its lintel: students in coloured chitons walk out in small groups, the priestess with more students by the altar beyond, the temple at the left and the great oak at the right
Where this book sits
Draws on
This book retells
Leads to
  • Consistency Analysis in Bloom: A CALM and Collected ApproachAlvaro et al. 2011
  • Win-Move Is Coordination-Free (Sometimes)Zinn, Green & Ludäscher 2012

Each link is an idea one paper took from another. Point at one, or tap it, to read how.

a paper this book retells a paper retold in another book a paper outside the series

The oracle at the fork from the hillside above its road in the evening light: the pale road climbing through scrub to the low walled enclosure, the great oak and the small tiled temple inside it, and the calm bay and its hills beyond
The oracle at the forkThe classification

It counsels, and never rulesA classification, not a protocol

At the fork of Paxos, on common ground that belongs to neither city, a low wall encloses an old oak, with a small temple beside it and a gate to the north and to the south. Groups of students bring the priestess the work they mean to do together, written on a strip of lead, and the priestess sends each group out by one gate or the other.*This book sorts questions asked of a group of machines, programs over facts spread across them, by their logical shape. It never decides or computes anything itself; it only says which questions can be answered without the machines waiting for one another.

The road northUp the stepped way to the Chamber, or on by the road to Schedia and up to its Tholos. A group sent north keeps a roster and waits for every name on it.Needs coordinationQuestions that need the machines to wait for one another, to agree or to hear from everyone, before answering.
The road southDown the road to the scholars' coast. A group sent south lives at library posts, with no roster.Coordination-freeQuestions that never wait: each machine answers from the facts it has, and nothing is ever taken back.
The work decidesThe priestess reads only the work. Its shape alone decides the road.The shape decidesWhich side a question falls on depends on its logical shape alone.
What is sorted

Two roadsTwo kinds of question

A group's work is always a question its members mean to answer, once they are settled at their posts in the libraries of Paxos, from the facts scattered across the libraries' copies of the compendium: a sighting of the comet recorded, a note that one entry cites another, or word that one scholar is waiting on another's correction.The questions are ones that machines want to answer from facts scattered across them: a record that a copy was made, a record that one item cites another, or word that a client is waiting for a lock.

No single library starts with all the facts. The rest arrive by courier, late, in batches or out of order. Yet every library wants to give consistent answers: once a library announces an answer it must never have to take it back, and in the end all libraries must announce the same set of answers.No single machine starts with all the facts. The rest arrive by message, late, in batches or out of order. Yet every machine wants to give consistent answers: once a machine announces an answer it must never have to take it back, and in the end all machines must announce the same set of answers.

If the oracle sends a group south, to live as scholars, each library can announce answers as facts come in, without ever waiting to coordinate with the others. If it sends them north, to live as legislators, no library can safely answer until the libraries coordinate to make sure everyone has been heard from.If a question is coordination-free, each machine can announce answers as facts come in, without ever waiting to coordinate with the others. If a question needs coordination, no machine can safely answer until the machines coordinate to make sure everyone has been heard from.

Compare two questions that sound almost the same: Has the comet been seen at least once? and Is this every sighting? As soon as a library hears of a single sighting it can answer yes to the first, and however many courier letters arrive later, that yes never becomes wrong. For the second, a library that has heard of three sightings cannot safely say three is all of them, because word of a fourth may be on the road at this moment.Compare two questions that sound almost the same: Has at least one copy of this item been made? and Is this every copy that has been made? As soon as a machine learns of a single copy it can answer yes to the first, and however many messages arrive later, that yes never becomes wrong. For the second, a machine that has heard of three copies cannot safely say three is all of them, because a fourth message may be in transit at this moment.

Four students in white, pale blue, pink and green walk up the path towards the oracle's south gateway, seen from behind, the great oak inside the wall and the small temple beyond
The road southCoordination-free

Questions that only grow

A question only grows (monotonic) when learning additional facts can only add new answers to the output, and can never invalidate or retract an answer already produced.

A growing question never needs coordination, because a library holding only some of the island's facts can announce at once every answer those facts support. Letters that arrive later, in whatever order and batches, even twice over, only add further answers beside the first ones (confluence).A growing question never needs coordination, because a machine holding only some of the facts can announce at once every answer those facts support. Messages that arrive later, in whatever order and batches, even twice over, only add further answers beside the first ones (confluence).

As long as every fact eventually reaches every library (by gossip or the festival), every library is guaranteed to converge to the exact same set of answers, without any library ever asking Have I heard everything yet?As long as every fact eventually reaches every machine (by gossip or anti-entropy), every machine is guaranteed to converge to the exact same set of answers, without ever asking Have I received everything yet?

From inside the oracle's enclosure by the great oak's trunk: four students in white, blue, pink and green walk out through the south gateway onto the road, hills and the sea beyond

Two questions, the same letters let the letters arrive, in an order drawn by lotTwo questions, the same messages let the messages arrive, in an order drawn by lot

No letter has arrived.No message has arrived.

Questions of this kind

Has the comet been seen?Has any copy been made?

Simple selection and projection: once a matching fact is seen, it remains seen forever.

Questions of this kind

Does one entry lead to another through a chain of citations?Do these two items cite each other through a chain?

Joining facts together and following chains (transitive closure): once a chain of citations links entry A to entry B, more citations elsewhere never break that chain.Joining facts together and following chains (transitive closure): once a chain of citations links item A to item B, adding more citations elsewhere never breaks that chain.

Questions of this kind

Is there a ring of libraries each waiting on the next?Is there a ring of machines each waiting on the next?

Every question that asks whether a pattern of facts exists only grows: once such a pattern appears it stays, as a stable property does in a snapshot taken across Arche.* And any program built by composing monotonic steps is monotonic as a whole.Every question that asks whether a pattern of facts exists only grows: once such a pattern appears it stays, as with the stable properties of a snapshot.* And any program built by composing monotonic steps is monotonic as a whole.

Only growing, stated exactly

A program P is monotonic if for any input sets S and T with S ⊆ T, P(S) ⊆ P(T). In a question, anything answered on fewer facts is still answered on more. The papers call a question confluent when it gives the same answers whatever the order and grouping of the news.

The road northNeeds coordination

Questions that rest on absence

A question rests on an absence (non-monotonic) whenever a new fact can take away an answer that looked true before. Is this every sighting? really asks Is there no sighting other than these? And Does no entry cite this one? asks for the absence of any citation.A question rests on an absence (non-monotonic) whenever a new fact can take away an answer that looked true before. Is this every copy? really asks Is there no copy other than these? And Has no one locked this item? asks for the absence of any lock.

You can usually spot a non-monotonic question by words of negation or completion: not, none, no one, every, only, highest, or count the total. Each of these depends not just on the facts a library has seen, but on the non-existence of any contradicting fact anywhere else on the island.You can usually spot a non-monotonic question by words of negation or completion: not, none, no one, every, only, highest, or count the total. Each of these depends not just on the facts a machine has seen, but on the non-existence of any contradicting fact anywhere else in the system.

A single delayed courier can carry the very fact that overturns there is none, so a library that answers a non-monotonic question from partial news is only guessing, and two libraries that hear the same facts in different orders can give conflicting answers along the way.A single delayed message can carry the very fact that overturns there is none, so a machine that answers a non-monotonic question from partial information is only guessing, and two machines that receive the same facts in different orders can give conflicting answers along the way.

What would make the answer safe

Knowing that nothing more is coming

Before a library can safely give an answer that rests on an absence, it must be certain that no missing fact is still on the road. That means hearing from the other libraries and agreeing that the input is complete, which is the work of an assembly and the thing that stalls when couriers are stopped.Before a machine can safely give an answer that rests on an absence, it must be certain that no missing fact is still in transit. That means hearing from the other machines and agreeing that the input is complete, which is what coordination is and what stalls during a partition.

Inside the oracle's enclosure: four students in green, rust red, grey and saffron walk past the plain stone altar towards the north gateway, the temple's columns at the right
The same picture, two questions

The waiting chain and the unwanted entryDeadlock detection and garbage collection

To see how sharply the word not separates the two roads, Hellerstein and Alvaro contrast two classic graph problems over three libraries, where each library initially knows only its own local link:To see how sharply the word not separates the two kinds, Hellerstein and Alvaro contrast two classic graph problems over three machines, where each machine initially knows only its own local link:

1. The ring of waiting (distributed deadlock detection): Library 1 knows that scholar A is waiting on scholar B's correction before writing their own; Library 2 knows that B is waiting on C; Library 3 knows that C is waiting on A. Once those three links exist, A, B and C wait on one another in a circle, and learning about other scholars elsewhere will never free them.1. Distributed deadlock detection: Node 1 knows that process A is waiting on process B; Node 2 knows that B is waiting on C; Node 3 knows that C is waiting on A. Once those three links exist, A, B, and C are deadlocked in a circle, and learning about other processes elsewhere will never un-deadlock them.

2. The unwanted entry (distributed garbage collection): The compendium keeps a core of entries and every entry the core cites, directly or through a chain; an entry that no chain from the core reaches may be withdrawn. Suppose Library 1 knows the core cites X, Library 2 knows X cites Y, and Library 3 holds Y and sees nothing citing it.2. Distributed garbage collection: The system keeps a set of root objects, along with any object reachable from a root by a chain of references; any object not reachable from a root may be collected. Suppose Node 1 knows the root references X, Node 2 knows X references Y, and Node 3 holds Y and sees no local reference to Y.

Three libraries, each with one link let them tell what they know, in any orderThree nodes, each with one link let them send what they know, in any order

The ring of waitingThe deadlock ring

    The entry Y, at Library 3The object Y, at Node 3

      Only the word not

      A path found is found forever; a path not yet seen may still be on the roadA path found is found forever; a path not yet seen may still be in transit

      Both problems trace paths across the same kind of graph. Yet the waiting ring asks whether a path exists (monotonic, the road south: as soon as all three links arrive, in any order, the ring is known for good), whereas withdrawing an unwanted entry asks whether a path does not exist (non-monotonic, the road north: Library 3 cannot safely withdraw Y until it has heard from every library and made sure that no chain from the core reaches Y).Both problems trace paths across the same kind of directed graph. Yet the deadlock ring asks whether a path exists (monotonic, coordination-free: as soon as all three links arrive, in any order, the cycle is known for good), whereas collecting an unreachable object asks whether a path does not exist (non-monotonic, needs coordination: Node 3 cannot safely collect Y until it has heard from every node and made sure that no chain from a root reaches Y).

      Who is everyone?

      The librarian without a rosterA machine without a roster

      Ameloot, Neven and Van den Bussche turned this into a proof by asking what a library can compute with no roster (obliviousness): not knowing the list of libraries on the island, nor even how many there are.Ameloot, Neven and Van den Bussche turned this into a proof by asking what a machine can compute with no roster (obliviousness): not knowing the list of machines in the system, nor even how many there are.

      A library with no roster can still answer every question that only grows. It shares the facts it holds with any neighbours it meets, takes in the facts they share, and gives every answer the facts gathered so far support. It never waits for everyone, so it never needs to know who everyone is. That is the scholars' life.A machine with no roster can still answer every question that only grows. It sends the facts it holds to any peers it contacts, receives the facts they send, and outputs every answer the facts gathered so far support. It never waits for everyone, so it never needs to know who everyone is.

      Now take a library with no roster and the simplest question that rests on an absence: Has every library withdrawn the entry? Each library that has withdrawn it sends out a slip with its name. The library collects 1 name, 2 names, 3 names, but without a roster saying there are 4 libraries in all, it can never know when the last one has spoken.Now take a machine with no roster and the simplest question that rests on an absence: Is the data empty at every machine? Each machine whose data is empty sends a message with its name. The machine collects 1 name, 2 names, 3 names, but without a roster saying there are 4 machines in all, it can never know when the last one has reported.

      Has every library withdrawn the entry? names of libraries that have withdrawn it come in, one by oneIs the data empty at every machine? names of machines with empty data come in, one by one

      0names heard4libraries on the rostermachines on the roster

      What the roster buys

      With a roster, you can answer anything, at the price of waiting for every name on it

      A library that holds the full roster (All) can answer any question: it waits until it has the facts of every library named on the roster, then works out the answer as if the whole island were one room. That is the legislators' life, and the road north. The whole difference between the two lives the oracle offers is the roster.A machine that holds the full roster (All) can answer any question whatsoever: it simply waits until it has received the complete collection of facts from every machine named on the roster, and then evaluates the question locally as if the whole system were a single machine. That is coordination.

      The law behind the counselThe theorem

      Why only questions that grow may take the road southWhy only growing questions are coordination-free

      Hellerstein (Hellersteinos) first stated the connection between growing (monotonicity) and not waiting (coordination-freeness) as the CALM conjecture in 2010. A year later, Ameloot, Neven, and Van den Bussche proved it by closing a three-way circle of equivalences:Hellerstein first stated the connection between growing (monotonicity) and not waiting (coordination-freeness) as the CALM conjecture in 2010. A year later, Ameloot, Neven, and Van den Bussche proved it by closing a three-way circle of equivalences:

      Step 1 · Monotone ⇒ No Roster

      It only grows

      If a question only grows, every library can broadcast the facts it holds and output all answers supported by the facts received so far. That requires no roster of the island (oblivious).If a question only grows, every machine can broadcast the facts it holds and output all answers supported by the facts received so far. That requires no roster of the system (oblivious).

      Step 2 · No Roster ⇒ No Waiting

      It needs no roster

      Suppose every library already starts with a full copy of the facts I. A library with no roster (oblivious) cannot tell whether it is alone on a one-library island or one of many unless it reads a message, so it must be able to give the full answer Q(I) without reading any (coordination-free).Suppose every machine already starts with a full copy of the facts I. A machine with no roster (oblivious) cannot tell whether it is alone in a one-machine system or one of many unless it reads a message, so it must be able to output the full answer Q(I) without reading any (coordination-free).

      Step 3 · No Waiting ⇒ Monotone

      It needs no waiting

      Suppose a question can be answered on some placing of the facts I without reading any messages, so Library v gives answer t ∈ Q(I) on its own. Now quietly hand extra facts (J ∖ I) to another library, v′. Library v still gives t before hearing from v′, and since answers are never taken back, t must be in Q(J). So Q(I) ⊆ Q(J): the question only grows.Suppose a question can be answered on some distribution of the facts I without reading any messages, so machine v outputs answer t ∈ Q(I) on its own. Now quietly hand extra facts (J ∖ I) to another machine, v′. Machine v still outputs t before hearing from v′, and since outputs are never retracted, t must be in Q(J). So Q(I) ⊆ Q(J): the question only grows.

      Steps 2 and 3 define without waiting (coordination-freeness) with care, because even a monotonic question needs messages if Library 1 holds a fact that Library 2 needs. To separate communication (carrying facts to where they are needed) from coordination (waiting to be sure no one else holds a contradicting fact), the proof asks whether there is some placing of the facts across the libraries, such as giving every library all of I, under which every library can answer with no messages at all. For a monotonic question there is. For a non-monotonic question, even a library handed the whole input I cannot know that the others hold nothing more until it coordinates with them.Steps 2 and 3 define without waiting (coordination-freeness) with care, because even a monotonic question needs messages if machine 1 holds a fact that machine 2 needs. To separate communication (shipping data to where it is needed) from coordination (waiting to be sure no one else holds a contradicting fact), the proof asks whether there is some distribution of the facts, such as giving every machine all of I, under which every machine can answer with no messages at all. For a monotonic question there is. For a non-monotonic question, even a machine given the whole input I cannot know that the others hold nothing more until it coordinates with them.

      The CALM theorem, as the papers state it

      A program has a consistent, coordination-free distributed implementation if and only if it is monotonic. Equivalently, for any query Q: Q is computed by a coordination-free transducer network, if and only if it is computed by an oblivious one, if and only if Q is monotone.

      Proof, in outline · that coordination-free, oblivious and monotone are equivalent

      A network N of nodes runs a transducer Π at each node. The input I is spread over the nodes by a horizontal partition H. Π is oblivious if it uses neither the relation Id (its own identifier) nor All (the identifiers of all nodes). Π is coordination-free if on every network, for every I, some partition has a run that reaches quiescence by heartbeat transitions only, that is, without reading a message. Claim. A query Q is computed by a coordination-free transducer iff by an oblivious one iff Q is monotone.

      1. This is Corollary 13 of Ameloot, Neven and Van den Bussche, with the definitions of their paper. A network N of nodes runs a transducer Π at each node: each node holds a part of the input I (a horizontal partition H of I over N), and repeatedly ingests received facts, updates local relations by queries, sends facts to other nodes and outputs. A run reaches quiescence when no more messages change anything. The network N with Π is consistent if every fair run on every partition of I outputs the same set, and Q(I) is that set. Π is oblivious if it uses neither the system relation Id (its own identifier) nor All (the identifiers of all nodes). Π is coordination-free on N if for every instance I there exist a horizontal partition H of I and a run on H that reaches a quiescence point by heartbeat transitions only, and coordination-free if it is so on every network.
      2. Monotone ⇒ oblivious (Theorem 6, outline). Given a monotone query Q, let each node send all the facts it holds to all other nodes, and at every step output Q of everything received so far. By monotonicity every output is a subset of Q(I), so no output is retracted, and in every fair run every node eventually holds all of I and outputs Q(I). This transducer uses neither Id nor All. (The paper's construction handles the query languages of its model with more care.)
      3. Oblivious ⇒ coordination-free (Proposition 11). On a one-node network, given I, an oblivious Π reaches quiescence with the output Q(I) by heartbeat transitions alone. On any other network place all of I at every node. Since Π is oblivious, a node cannot tell that it is not alone unless it communicates, so by heartbeats it acts as on the one-node network and each node outputs Q(I).
      4. Coordination-free ⇒ monotone (Theorem 12). Let Q be computed by a coordination-free Π, let I ⊆ J and t ∈ Q(I). Take a network with at least two nodes. By coordination-freeness there is a partition H of I on which t is output at some node v by heartbeats only. Let v′ ≠ v and define the partition H′ of J by H′(v) = H(v) and H′(v′) = H(v′) ∪ (J ∖ I). The partial run on H up to the output of t is also a partial run on H′, and extends to a fair run, so t is output on J. By consistency t ∈ Q(J). Hence Q(I) ⊆ Q(J).
      5. The three steps give (3) ⇒ (2) ⇒ (1) ⇒ (3).∎
      Proof · that the emptiness query is not coordination-free

      The query asks, of an input set S spread over the nodes, whether S is empty. Id gives a node its own identifier and All the identifiers of all nodes; a heartbeat transition is a step in which a node reads no message. Claim. No transducer computes the query coordination-free, and the query is not monotone.

      1. This is Example 10 of the same paper. The query asks, of an input set S spread over the nodes, whether S is empty. Every node can hold a part of S.
      2. A transducer that computes it makes each node send out its identifier, read from Id, on condition that its local S is empty, forwards identifiers received, and outputs ‘true’ when it has received the identifiers of all nodes, checked against All.
      3. On any partition, to output ‘true’ a node must know that every other node's part is empty, which it can only learn from a message. So no partition, including the one that gives every node the whole input, lets the output be reached by heartbeats alone. Hence the query is not coordination-free, and it is not monotone: S = ∅ gives ‘true’ and a larger S does not.∎

      This ties CALM to the trade met at the camps of Arche:* a program that needs no coordination stays available when couriers are stopped. The scholars' life goes on while the couriers are stopped; the legislators' life must wait for them.This ties CALM to the CAP theorem:* a program that needs no coordination stays available during a partition, and a program that needs coordination must wait.

      Most business is mixed

      Waiting only once

      A reader's business is seldom made only of growing questions. Take a reader building a reading list: along the way the reader adds titles, strikes titles off, and at last closes the list so that the library can fetch the scrolls.In real life, a program rarely consists solely of growing questions. Consider a shopping cart (as in Amazon's Dynamo): along the way, a client adds items, removes items, and finally checks out so the service can fetch the goods.

      Adding a title and striking a title can both be kept as two grow-only lists (added and struck), as the libraries keep the cross-references of an entry with a struck-off list,* and the two merge in any order with no waiting. Only the final step, closing the list and taking the difference added \ struck, is non-monotonic: if the closing notice reaches the library before an earlier Add or Strike notice still on the road, the library fetches the wrong scrolls.Adding an item and removing an item can both be represented as two grow-only sets (added and removed), as replicated data types do,* and the two merge in any order with no waiting. Only the final step, checking out and taking the set difference added \ removed, is non-monotonic: if the checkout message reaches the service before an earlier Add or Remove message still in transit, the service fetches the wrong goods.

      Even that one non-monotonic step needs far less waiting than a full assembly if the reader seals the closing notice with a manifest: a list of all the Add and Strike notices the reader sent before closing. The library then need not ask every other library on the coast; it waits only until the notices named on the manifest have arrived, in any order, and then fetches the scrolls.Even that one non-monotonic step needs far less waiting than full coordination if the client seals the checkout message with a manifest: a list of all the Add and Remove messages the client sent before checking out. The service then need not ask every other machine; it waits only until the messages named on the manifest have arrived, in any order, and then fetches the goods.

      Four notices on the road deliver them to the library in any orderFour messages in transit deliver them to the service in any order

      Nothing has arrived.

      Sparing the waiting

      Isolate and seal the non-monotonic step

      Keep all the intermediate Add and Strike steps monotonic so they never wait, and attach a manifest to the single closing step so it waits only for the exact messages it depends on.Keep all the intermediate Add and Remove steps monotonic so they never wait, and attach a manifest to the single checkout step so it waits only for the exact messages it depends on.

      Sparing the waiting

      Move coordination off the reader's pathMove coordination off the client's path

      Throwing away old struck-off tombstones, or withdrawing entries nothing cites, rests on an absence, so it needs everyone to be heard from; but it can be done in the background, where no reader is waiting at the counter.Discarding old tombstones or unreachable objects rests on an absence, so it needs everyone to be heard from; but it can be done lazily in the background, where no client is waiting.

      Sparing the waiting

      Apologize afterwards (Compensation)

      If two scholars who each read a count and write it one higher without coordination occasionally lose one of the two, it is often cheaper to let the rare clash happen and put the count right afterwards than to make every scholar wait on an assembly.If selling the last unit of an item without coordination occasionally double-sells it, it is often cheaper to let the rare clash happen and send an apology or a replacement afterward than to make every buyer wait on coordination.

      The lesson of CALM is not that every program can be made monotonic. It is that by spotting the exact points where a program stops growing and rests on an absence, a designer can confine coordination to those narrow points and let everything else run free.

      The same island, sortedThe same systems, sorted

      Where each road leadsWhat falls on each side

      From the oracle at the fork of Paxos, the reason the whole island is laid out as it is comes into view.With the classification in hand, the layout of practical systems makes sense.

      Much of what lives south of the fork on the scholars' coast is built to grow monotonically: the pebble columns that count a comet's sightings and the tagged cross-references,* the larger-tally-wins versions spread by word of mouth and at the festival,* and the cords and causal dependencies held back until complete in the reading rooms.*Much of what sits on the coordination-free side is built to grow monotonically: the vector entries and tagged sets of replicated data types,* the larger-timestamp-wins values spread by gossip and anti-entropy,* and the causal dependencies held back until complete.*

      And every question that must walk north to the Chamber or the Tholos rests on an absence or a global total order: deciding which of two conflicting laws occupies decree slot k, keeping two scholars who each read a count and write it one higher from losing one of the two, guaranteeing that a read returns the latest version, or verifying that every library has seen a tombstone so it can be thrown away.And every question that needs coordination rests on an absence or a global total order: deciding which of two conflicting values occupies log slot k, preventing a lost update when two clients read and increment the same counter, guaranteeing that a read returns the latest version, or verifying that every machine has seen a tombstone so it can be discarded.

      The oracle at the fork from above: the low walled enclosure with its oak and small temple among the woods, and a small group of students walking away along each road

      Bring a work to the oracle the page tries each question on every set of facts and its every enlargementSort a question the page tries each question on every set of facts and its every enlargement

      Choose a question.

      There is no third road: mathematically, a problem is either monotonic or it is not. The only trap is syntactic: a programmer can accidentally write a monotonic question using non-monotonic steps, which is why languages like Bloom analyze a program's rules to highlight the exact lines where negation or aggregation forces a wait.There is no third category: mathematically, a problem is either monotonic or it is not. The only trap is syntactic: a programmer can accidentally write a monotonic question using non-monotonic steps, which is why languages like Bloom analyze a program's rules to highlight the exact lines where negation or aggregation forces a wait.

      The limits

      What it does not say

      The oracle sends every group down one of its two roads. Five things it does not do.The classification sorts every question into one of two kinds. Five things it does not do.

      Does it tell you how to rewrite a problem so it only grows?

      No. CALM is a classification theorem, not an automatic compiler. Knowing that monotonic problems need no coordination still leaves the designer two hard tasks: figuring out whether a problem can be reformulated monotonically (as CRDTs do for counters and sets), and implementing it efficiently.

      Was the original 2010 conjecture true word for word?

      Not quite. Hellerstein originally phrased CALM in terms of syntactic Datalog rules without negation, and later work showed that some semantically monotonic queries cannot be expressed in positive Datalog. What was proved, and what matters, is semantic monotonicity (S ⊆ T ⇒ Q(S) ⊆ Q(T)).

      Does “coordination-free” mean zero messages?

      No. Facts still have to travel from the library that holds them to the libraries that need them. Coordination-freeness means that a library that already holds the relevant facts need not exchange messages just to check whether others hold contradicting ones.No. Facts still have to travel from the machine that holds them to the machines that need them. Coordination-freeness means that a machine that already holds the relevant facts need not exchange messages just to check whether others hold contradicting ones.

      Does confluence guarantee recency?

      No. CALM guarantees confluence: all libraries in the end give the same output, whatever the order of the letters. It does not guarantee linearizability (is this the latest state right now?), which itself rests on the absence of newer writes elsewhere.No. CALM guarantees confluence: all machines in the end produce the same output, whatever the order of messages. It does not guarantee linearizability (is this the latest state right now?), which itself rests on the absence of newer writes elsewhere.

      What if libraries know how facts are partitioned in advance?What if machines know how facts are partitioned in advance?

      Subsequent work (such as Zinn, Green, and Ludäscher 2012) showed that if data is partitioned by a known hash or policy Rule (policy-aware transducers), certain non-monotonic queries can also be answered without messages because each library already knows which subset of facts could possibly exist elsewhere.Subsequent work (such as Zinn, Green, and Ludäscher 2012) showed that if data is partitioned by a known hash or policy rule (policy-aware transducers), certain non-monotonic queries can also be answered without messages because each machine already knows which subset of facts could possibly exist elsewhere.

      A program has a consistent, coordination-free distributed implementation exactly when it is monotonic.

      The line is bright, and it is no recipe: it does not say how to find a monotonic form of a problem.

      Setting Students Asking Which Life to Lead

      The paper behind this book

      Joseph M. Hellerstein, The Declarative Imperative: Experiences and Conjectures in Distributed Logic. SIGMOD Record 39(1), 2010, 5–19; the text of the keynote at the ACM Symposium on Principles of Database Systems (PODS), 2010. — The CALM conjecture and its companions.

      Tom J. Ameloot, Frank Neven and Jan Van den Bussche, Relational Transducers for Declarative Networking. arXiv:1012.2858, December 2010; Journal of the ACM 60(2), 2013. — The formal definitions of consistency and coordination-freeness and the proof of the CALM theorem.

      Joseph M. Hellerstein and Peter Alvaro, Keeping CALM: When Distributed Consistency Is Easy. arXiv:1901.01930, January 2019; Communications of the ACM, 2020. — The theorem restated, with examples, design patterns and open questions.

      The ideas, plainly.

      Hellerstein asked which computations a group of machines can carry out without ever waiting for one another, so that they stay available when the network is cut and are not slowed by coordination. His conjecture, CALM, is that those are exactly the monotone computations: ones whose output only grows as the input grows, so that no answer ever has to be retracted. Deadlock detection is monotone, since a cycle found stays found. Garbage collection is not, since to be sure an object is unreachable a machine must know that it has heard everything.

      Ameloot, Neven and Van den Bussche proved it in a model of machines running relational queries and exchanging facts. A computation is coordination-free if there is some distribution of the data on which it reaches its answer without messages; they show this is exactly the monotone queries, and also exactly those answered by machines that know neither their own names nor the others'. Without that knowledge a machine cannot tell that it has heard from everyone, which is what a non-monotone query needs.

      Hellerstein and Alvaro restate it for practice. A non-monotone step can often be isolated and sealed, so that only it waits, and only for what it names; coordination can be moved off the critical path; or an error can be apologised for afterwards. The result is a bright line, not a recipe: it does not say how to find a monotone form of a problem, and what it guarantees is that the outcome does not depend on the order of the news, not that it is the newest.

      Hellersteinos stands for Joseph Hellerstein, the author of the first and third papers. The papers have five authors, Joseph M. Hellerstein, Peter Alvaro, Tom J. Ameloot, Frank Neven and Jan Van den Bussche, and all are credited here; only Hellersteinos is named, and the librarians and scholars are told apart by what they do.

      In the paper, term by term
      the oracle at the fork, counselling and never rulingThe CALM theorem as a classification of programs. Hellerstein–Alvaro §1.4; Ameloot et al. §6.
      a group's work brought to the oracleA program or query. Ameloot et al. §2.
      the facts held by each library; the rest by courierA network of machines, the input horizontally partitioned across them; asynchronous messages. Ameloot et al. §3.
      a question that only growsA monotonic program: S ⊆ T implies P(S) ⊆ P(T). H–A Definition 1.
      the same answers whatever the order and grouping of the newsConfluence, program consistency; consistent networks. H–A §2.1; Ameloot et al. §3.
      a question that rests on an absenceA non-monotonic program: negation, set difference, universal quantification, deletion. H–A §1.4, §2.2.
      a ring of waitingDistributed deadlock detection: cycles in a waits-for graph; monotone. H–A §1.3.1.
      a work no one cites, thrown awayDistributed garbage collection: unreachability from the root; non-monotone. H–A §1.3.2.
      a once-true, always-true propertyA decision on incomplete information that is stable. H–A §1.3.1.
      the road south, the scholars' life: no roster, no waitingCoordination-freeness. Ameloot et al. §5; H–A Theorem 1.
      the road north, the legislators' life: waiting for every name on the rosterCoordination: Paxos, two-phase commit, barriers. H–A §1.1.
      a sharing of the facts on which no letter is neededCoordination-free: some horizontal partition and a run to quiescence by heartbeat transitions only. Ameloot et al. §5.
      the librarian with no rosterAn oblivious transducer: uses neither Id nor All. Ameloot et al. §5, Proposition 11.
      the roster; heard from everyoneThe All relation: network membership. H–A §2.2.
      every library tells all it has; with a roster, any question can be answeredTheorem 6: monotone queries by oblivious transducers; every query with the network known. Ameloot et al. §4.
      is the shelf empty at every library?The emptiness query: not coordination-free. Ameloot et al. Example 10.
      growing, no roster, no waiting, one propertyThe CALM property: coordination-free ⇔ oblivious ⇔ monotone. Ameloot et al. Corollary 13.
      the stopped couriers, and the life that goes onCoordination-freeness equals availability under partition. H–A Observation 1.
      the reading list: adds and strikes as two growing listsThe shopping cart as two growing sets (Dynamo); tombstones. H–A §2.1.1, §3.1.
      closing the list, with a manifest of notices before itCheckout enhanced with a manifest of update message IDs; sealing the non-monotone step. H–A §2.1.1.
      settling the struck titles slowly in the backgroundCoordination off the critical path: lazy distributed deletion. H–A §3.4.
      putting a count right afterwards, not preventing the clashCompensation in place of coordination. H–A §3.4.
      the conjecture's rules too narrowThe Datalog form of CALM is false literally; the monotone form is proved. Ameloot et al. §6.
      no way given of finding a growing formCALM is not a constructive result. H–A §6.
      which questions can be answered if the libraries know how facts are shared outExpressiveness; weaker forms of monotonicity. H–A §4.1.