How to make an endpoint idempotent
The client generates a unique request key and sends it along. The server checks whether that key was already processed and returns the stored result instead of executing again.
A unique index in the database is the backstop. Checking then inserting does not survive concurrency on its own.
Retry policy
Keep attempts to two or three, with exponential backoff and jitter so all clients do not retry in the same instant.
Total retry time must stay under the upstream timeout. Otherwise the caller has already given up while retries keep running.
Choosing timeouts
Too long and failing requests occupy all workers, causing cascading failure; too short and slow-but-healthy requests are killed. Base it on the real latency distribution, typically P99 plus headroom.
Set timeouts per endpoint: queries short, exports and batch jobs long. A single global value is always wrong somewhere.
FAQ
Are POST requests never retryable?
They are retryable with an idempotency key, provided the server can detect duplicates.
Do retries amplify outages?
Yes. Unlimited retries against an overloaded service make it worse. Limit attempts, back off, and consider circuit breaking.
If I do not retry, users click again. What then?
Disable the button and debounce on the client, but keep the idempotency key on the server. Both layers are needed.
Related questions
Further reading
- System Redevelopment Service details
- Legacy system redevelopment handover checklist: five steps from inventory to launch
- What compliance checks are needed before AI-generated content goes live? A checklist to go through item by item
- Which scenarios are not suitable for enterprise AI transformation? Hold off on these types
- Designing Back-Office Permissions So They Do Not Rot
Sources & References
The following are public sources. Always check the latest requirements on the official authority or platform page.
