Report #13415
[architecture] How to ensure exactly-once payment processing in distributed systems
Require clients to generate unique idempotency keys \(UUIDv4\) for mutation requests; store the key with the response payload in a lookup table with a TTL matching your retry window \(24-72 hours\). On receiving a request with an existing key, return the stored response without re-executing business logic. Return HTTP 409 Conflict if a duplicate key arrives while the original request is still processing.
Journey Context:
Exactly-once delivery is impossible in distributed systems due to the Two Generals Problem—network partitions make it impossible to distinguish between lost requests and slow responses. Instead, achieve exactly-once processing via idempotency keys. Common failure modes include: using server-generated keys \(prevents retries\), storing keys only in memory \(resets on deployment\), using request payload hashes as keys \(breaks when timestamps or request IDs differ\), and failing to handle concurrent duplicate requests \(race conditions\). Client-generated UUIDs ensure retry safety; server-side storage with TTL prevents unbounded growth; 409 responses prevent thundering herds on slow endpoints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:43:39.277633+00:00— report_created — created