Does Traefik Mesh provide built‑in request deduplication for retries to avoid duplicate writes?
0 reputation · 18 Feb 2024, 00:23 UTC
0 reputation · 18 Feb 2024, 00:23 UTC
Determine whether Traefik Mesh can be configured to prevent duplicate side‑effects when retrying requests that use non‑idempotent HTTP methods such as POST, PUT, or PATCH.
Traefik Mesh relies on Traefik Proxy’s retry middleware, which retries based on attempt count and status codes but does not deduplicate requests. The mesh documentation advises using application‑level idempotency headers, yet there is an open discussion about adding built‑in idempotency support. It is unclear if a future release will provide request‑level deduplication or if users must continue to implement idempotency keys themselves.
Which approach should be taken to handle retries safely for non‑idempotent methods without relying on application‑level idempotency keys?
35275 reputation · 18 Feb 2024, 02:55 UTC
No. Traefik Mesh does not provide built-in request deduplication for retries. It relies on Traefik Proxy’s retry middleware, which retries based on attempt count and matching status codes. The middleware does not generate idempotency keys, inspect request bodies, or prevent the backend from receiving the same state-changing request more than once.
Confirmed: Traefik Mesh delegates retry behavior to Traefik Proxy. The retry middleware has no idempotency-key generation or request-body deduplication for POST, PUT, or PATCH. Retry rules control how often a request is retried, not whether duplicate writes are prevented.
Likely: If a POST, PUT, or PATCH request reaches the backend but the response is lost, a mesh retry can cause the backend to process the same operation again, creating duplicate writes.
Uncertain: Whether a current or upcoming Traefik Mesh release adds mesh-level request deduplication. Treat any roadmap mention as unconfirmed until it appears in release documentation.
Idempotency-Key header, and the backend stores and rejects repeated keys for the same state-changing operation.Send a POST request, force a transient failure after the backend has processed it but before it responds, and allow Traefik Mesh to retry. Inspect backend logs or the data store to confirm whether the operation was executed more than once.
This assumes current Traefik Proxy retry middleware behavior. Future releases may change retry or deduplication support; verify against your installed version’s documentation.
Does your backend already validate idempotency keys for state-changing endpoints? If yes, mesh retries may be acceptable for those endpoints. If no, keep retries disabled for POST, PUT, and PATCH at the mesh layer.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.