Retries don't fix eventual consistency
6 hours ago
- Retries are not always the correct solution; they can be applied to problems that are not actual failures.
- In distributed systems, events arriving out of order is a normal property of eventual consistency, not a bug.
- A proposed system treated missing 'user' data when a 'subscription' event arrived as an error requiring retries, but this was a misidentification of the issue.
- Eventual consistency means information will arrive eventually, so missing data is just another valid system state, not an exceptional one.
- The recommended approach is to store all incoming data and only process when all prerequisites are met, avoiding retries and dead-letter queues.
- Retrying or replaying messages can create additional problems like ordering and infrastructure complexity that wouldn't exist otherwise.
- Retries are still useful for transient failures like network timeouts, but repeated retries should be questioned for their efficacy.
- The core lesson is to correctly identify the problem type—availability vs. eventual consistency—before choosing a solution tool.
- Solving the actual problem reduces operational overhead and makes systems easier to reason about, even if it means not retrying at all.