Idempotence
Summary: A property of an operation such that it can be applied multiple times without changing the result beyond the initial application.
Sources: chapter12
Last updated: 2026-04-18
Idempotence is a key concept in achieving exactly-once-semantics and building fault-tolerant data systems. An idempotent operation can be safely retried if a failure occurs, ensuring that the system ends up in the same state as if the operation had succeeded on the first attempt (source: chapter12).
Achieving Idempotence
While some operations are naturally idempotent (e.g., setting a value to a specific constant), many are not (e.g., incrementing a counter or processing a payment). For non-idempotent operations, idempotence can be achieved by:
- Operation Identifiers: Generating a unique ID for each request at the client and checking it at the server to ensure the operation is only executed once. This is a common pattern in payment processing and distributed transactions (source: chapter12).
- Deterministic Derivation: In unbundled systems, ensuring that the function used to derive a dataset from an event log is deterministic. If the function is rerun on the same log, it will always produce the same result (source: chapter12).
Role in Fault Tolerance
Idempotence is the standard way to handle retries in distributed systems. When a network request times out, the client cannot know if the server processed the request before failing. By making the request idempotent, the client can safely retry without risking duplicate side effects (source: chapter12).