> Term
Idempotency
The property of certain operations where they can be applied multiple times without changing the result beyond the initial application.
Detailed Explanation
In distributed systems, idempotency guarantees that if a client sends a request and it fails or times out, they can safely retry the exact same request without accidentally duplicating the action.
It is usually implemented by having the client generate a unique 'Idempotency Key' for each operation. The server stores this key and the response, and if it sees the same key again, it simply returns the cached response.
Why It Matters
Without idempotency, a network blip during checkout could cause a user's credit card to be charged multiple times when their browser automatically retries the request.
Common Failure Mode
Practical Example
Production Manifestation
Payment gateways like Stripe mandate idempotency keys for all mutating requests. In REST APIs, GET, PUT, and DELETE methods are expected to be idempotent by design.
Frequently Asked Questions
What is Idempotency in short?
The property of certain operations where they can be applied multiple times without changing the result beyond the initial application.
What is the most common failure mode?
An API is assumed to be idempotent but actually isn't, resulting in duplicated records, double charges, or inconsistent state when clients follow standard retry policies.
AI Summary
The property of certain operations where they can be applied multiple times without changing the result beyond the initial application. Without idempotency, a network blip during checkout could cause a user's credit card to be charged multiple times when their browser automatically retries the request.
