liveBook · Manning

Chapter 4: Message delivery and processing

What you will learn in chapter 4 of Think Distributed Systems

The chapter introduces message delivery and processing by distinguishing literal exactly-once processing from exactly-once processing semantics and warning against assuming guarantees are broader than stated.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces message delivery and processing by distinguishing literal exactly-once processing from exactly-once processing semantics and warning against assuming guarantees are broader than stated.

Key terms: exactly-once processing, exactly-once processing semantics, retries, duplicates, mental model, limitations

4.1 Exchanging messages

This section establishes the failure model and request–response dialogue used to distinguish message delivery from processing and to frame the chapter’s once-only semantics.

Key terms: partially synchronous system model, volatile, durable, Byzantine failures, local state, sender, receiver, request, response, side effect

4.2 The uncertainty principle of message delivery and processing

The section connects a component’s limited local view to the sender’s shift from certainty to uncertainty during message delivery and processing.

Key terms: local view, global view, state of certainty, state of uncertainty

4.2.1 Before sending the request

4.2.2 After sending the request and before receiving a response

After sending a request but before receiving a response, the sender cannot tell whether the receiver has processed it or what will happen next.

Key terms: sender, receiver, request, response

4.2.3 After receiving a response

A received response resolves uncertainty about the work, but TCP’s reliable transmission does not guarantee that an application receives and processes a message.

Key terms: response, success, failure, Byzantine failures, TCP, acknowledgments, retransmissions, deduplicates, local buffer, socket interface

4.3 Silence and chatter

The section explains why a missing response cannot reveal whether a request was processed, and why retries and simple duplicate tracking cannot guarantee exactly-once processing.

Key terms: timeout, partially synchronous, true positive, false positive, side effect, at-most-once processing, at-least-once processing, exactly-once processing, duplicate requests, duplicate

4.4 Exactly-once processing semantics

This section defines exactly-once processing as an application-defined equivalence of outcomes and explains why it requires both sender and receiver participation.

Key terms: exactly-once processing semantics, equivalence, processing outcome, end-to-end guarantee, at-least-once delivery and processing, sender, receiver

4.5 Idempotence

This section explains how idempotence makes repeated message processing have the effect of processing once, and how applications can achieve that effect with idempotence keys and transactional deduplication.

Key terms: idempotence, at-least-once message processing, exactly-once processing semantics, write-once register, credit card, inherently idempotent, idempotence key, UUID, deduplicate, end-to-end guarantee

4.6 Case study: Charging a credit card

The credit-card charging case shows how retries, idempotency keys, and the user’s experience complicate the promise of exactly-once processing.

Key terms: request, response, bounded number of times, idempotency key, reservation number, UUID, status code, body, exactly-once processing semantics, pending charges

4.7 Summary

The section summarizes why failures rule out exactly-once message delivery and processing, how exactly-once processing semantics can still be achieved, and why idempotence is difficult.

Where this is used later

Concepts explained in this chapter

← Chapter 3: Failure tolerance Chapter 5: Transactions →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.