Definition
Idempotency is the property that applying an operation multiple times produces the same result as applying it once. It is what makes retries safe: networks fail after a request is processed but before the response arrives, so clients must retry — and without idempotency, a retried payment double-charges the customer.
The standard mechanism is an idempotency key: the client attaches a unique key to each logical operation, and the server stores the result under that key, returning the stored result if the same key arrives again instead of executing twice. The same requirement appears on the consumer side of message queues: at-least-once delivery means duplicates will arrive, so processing must be deduplicated by message ID or written with conditional updates.
How it comes up in interviews
Any design with retries, queues, or webhooks gets the follow-up "what happens when this runs twice?" Strong candidates volunteer idempotency keys on every mutating endpoint and idempotent consumers behind every queue, rather than waiting to be asked. "Exactly-once processing" claimed for free is the red flag — it is really at-least-once delivery plus idempotent processing.