← All concepts
Reliability & correctness
Idempotency
Make an operation safe to repeat, so retries never cause double effects.
Networks fail after a request is processed but before the response arrives. The client retries — and without protection, a payment is charged twice or an order is created twice.
See it in action
Step through the scenarios on the diagram.
Laying out diagram…
1/4The client sends a charge with key abc-123.
- Client
- — Retries on timeout
- Payments API
- — Checks the idempotency key first
- Idempotency store
- — key → saved response
- Card network
- — Actually moves money
How it works
- Clients send an idempotency key; the server stores key → result and returns the stored result on repeats.
- Unique constraints (e.g. one like per user per post) make writes naturally idempotent.
- Event consumers dedupe by event or entity id.
Trade-offs
- Keys must be stored (with expiry) and checked atomically.
Seen in
- WhatsApp / MessengerBillions of real-time messages per day
- UberReal-time ride matching at global scale
- AmazonHigh-traffic e-commerce marketplace
- Payment gatewayStripe-style card payments with an exactly-once ledger
- DropboxFile sync across every device
- BookMyShowMovie and event tickets with live seat selection
- MakeMyTripFlights and hotels aggregated from many suppliers
- Airline reservationsFlights, seats, bookings and check-in for one airline
- AirbnbSearch, book and message for vacation rentals
- Meeting schedulerFind a time, book a room, invite everyone
- Car rentalReserve a car by class, pick up, drive, return
- Zomato / food deliveryRestaurant discovery, ordering and live delivery tracking
- Urban CompanyBook vetted professionals for home services
- Porter / goods deliveryBook a truck or bike to move goods across the city
- Practo / teleconsultationFind doctors, book appointments, consult over video
- AstroTalkPay-per-minute chat and calls with astrologers
- Buy now, pay laterInstant credit at checkout, repaid later
- Stock brokerageLive quotes, order placement and portfolios