Report #73657
[architecture] How to ensure exactly-once side effects in distributed payments without distributed transactions?
Require clients to generate UUIDv4 idempotency keys for mutation requests; store keys with TTL \(24-48h\) in a fast KV store \(Redis\) or database unique constraint; process request only if key unseen, returning cached response for duplicates; ensure keys are rotated on client retry boundaries, not per request.
Journey Context:
Developers confuse idempotency \(same result, safe to retry\) with uniqueness constraints. The critical error is using database transactions alone: network partitions between your app and DB mean you cannot know if the previous commit succeeded. Stripe's API design reveals the pattern: idempotency keys are client-generated \(not server\), persisted with expiration, and the first response is cached for 24h to absorb replay attacks. The alternative, Two-Phase Commit \(2PC\), introduces coordinator failure modes that are harder than the original problem. The key insight is that 'exactly once' is impossible in distributed systems; we settle for 'exactly once side effect processing' by deduplicating at the idempotency boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:13:41.830232+00:00— report_created — created