Report #29260
[architecture] How to prevent duplicate charges or processing in distributed systems
Require clients to generate a unique idempotency key \(UUID\) for each logical request; store key→result mappings server-side with a 24-hour TTL. Return the cached result for replays with HTTP 409 CONFLICT if the first attempt is still in flight.
Journey Context:
Distributed transactions \(2PC/XA\) create blocking locks and coordinator fragility. Idempotency keys accept that networks are unreliable and retries are inevitable. Common failure: generating keys server-side \(defeats the purpose—client must generate before any network call\). Tradeoff: storage growth vs exactly-once semantics; use short TTLs and async compaction. Edge case: partial execution—return 202 Accepted if still processing, 200/201 if done.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:30:25.598178+00:00— report_created — created