Report #65870
[architecture] Preventing duplicate API requests in distributed systems without distributed locks
Use client-generated UUID idempotency keys with 24-hour idempotency windows, storing keys in Redis with TTL, rejecting reuse with 409 Conflict. Keys must be provided by the client in an Idempotency-Key header and the server caches the response against that key for the window duration.
Journey Context:
Developers often implement database unique constraints or distributed locks, but that creates tight coordination and bottlenecks at the database layer. Stripe's approach uses ephemeral storage \(Redis\) with TTL to handle network retries without the overhead of distributed transactions. The critical insight is that idempotency windows are business-specific \(usually 24 hours\) and the storage can be volatile because it acts as a cache, not a source of truth. Alternatives like exactly-once delivery require Kafka or similar complexity that is overkill for most REST APIs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:02:30.765867+00:00— report_created — created