Partial failure and the uncertain request
Reason about what a client knows when a remote operation times out.
What you’ll learn
- Distinguish a timeout from proof that a write failed
- Trace a safe retry using an operation identifier
- Explain causal order without relying on synchronized wall clocks
A missing reply leaves uncertainty
A browser asks a progress service to mark a lesson complete. The service commits the update, but the response is lost before reaching the browser. From the learner’s perspective the request timed out; from the database’s perspective the work succeeded. A timeout tells the caller that it did not obtain a reply before its deadline. It does not establish which instructions the remote system executed. This difference becomes important whenever a retry can repeat a meaningful side effect.
Trace one operation through a retry
Give the completion operation a stable identifier, such as learner-7:lesson-12:completion-1. The first attempt records that identifier and applies the intended state change in one appropriate atomic boundary. When the caller repeats the same operation, the service recognizes the identifier and returns the recorded outcome without applying the effect twice. The record needs a defined retention policy and a check that the repeated identifier carries compatible input. A unique key alone is useful only when the surrounding write protocol actually enforces the intended behavior.
Retries consume capacity
If every waiting caller retries immediately during an outage, the extra load can make recovery harder. A bounded retry policy combines deadlines, a maximum number of attempts, and increasing delays with random variation where appropriate. Decide which failures are retryable and whether the operation is safe to repeat. Retrying invalid credentials or malformed input usually does not repair them. Also watch nested retries: three attempts in one layer and three in another can multiply work beyond what the original caller expects.
Order events with evidence
Suppose service A sends a message that service B receives. The send precedes that receive in the causal relation, regardless of what the two wall clocks display. Events on separate services without a connecting causal chain may be concurrent in this model. A timestamp sorted in a dashboard can be useful for investigation, but clock disagreement means it is not a complete proof of causality. Record request and operation identifiers so you can reconstruct the message path as well as its displayed times.
State the guarantee precisely
Avoid promising exactly once without explaining the scope, storage assumptions, and failure conditions. A queue may redeliver a message, while the application can still ensure that a particular database effect is recorded once under its transaction and uniqueness rules. Test the uncertain moment: crash after applying an effect and before acknowledging the message, then restart the consumer. A successful test should show the same final progress state and an understandable record of duplicate delivery rather than relying on fortunate timing.
Try it yourself
A worker grants a learner 10 points, then crashes before acknowledging its queue message. The message is delivered again. Design a record that prevents an accidental second grant and say what must happen atomically.
Show a possible solution
Use a stable award operation ID with a uniqueness constraint, and atomically record that ID with the points change in the same transactional storage boundary. On redelivery return the already recorded outcome. If those writes are separate, a crash between them can lose or duplicate the award.
Check your understanding
Try 11 questions across distributed systems. Read each explanation and revisit anything that needs another pass.
Practise this subjectGo to the source
Use these primary references to check details and explore the topic further.
Saved in this browser. Signed-in progress syncs to your account.