Study guide: Design a Reliable Request Workflow
Two increment requests read count 5 and both write 6. Explain the defect, a preservation strategy and a bounded retry policy with delays 1,2,4 seconds.
Ideas to explain in your own words
- An API contract describes accepted request fields, allowed operations and response meaning. A successful syntax parse does not establish authorization or a valid business operation. The paper contract permits a count update only after validation and access checks; it specifies failures before any write.
- An idempotent operation has the same intended effect when repeated as when performed once. Setting a flag to true differs from adding one to a counter. Request retries need known server semantics and deduplication where appropriate. Response codes may differ even when the intended repeated effect is unchanged.
- Concurrent requests can read the same earlier value and overwrite one another’s changes. In the supplied model two increments both read count 5 and each writes 6, so the final count 6 misses one increment. Atomic updates or an appropriate concurrency policy can protect the intended result.
- A retry policy specifies when to retry, maximum attempts and delay scheduling. Bounded retries avoid indefinite repeated work. Our model has fixed listed delays and assumes no request-processing time; adding them gives waiting time only. Mutating operations still require safe repeated-effect semantics.
Useful vocabulary
- API contract
- Accepted requests and their promised responses/effects.
- idempotent
- Repeated operations have the same intended state effect.
- lost update
- One concurrent change is overwritten by another.
Watch your reasoning
- A200-like response label cannot replace verification of the saved result.
- Idempotent does not mean the server produces identical responses or no logs.
- Two individually valid requests can still conflict when they share state.
- Retrying every failure indefinitely is not a reliability plan.
A worked review example
Determine whether the body has readable structured syntax. Which check or operation is described? The supported answer is Parse structure. Check syntax, input contract and authorization before the permitted state change. A200-like response label cannot replace verification of the saved result. An API contract describes accepted request fields, allowed operations and response meaning. Policy allows three retry delays of 1, 2, 4 seconds after the initial request. Total delay budget, excluding request time? The supported answer is 7 seconds. Applying the stated rule gives 7 seconds. Add the listed retry delays and respect the maximum attempt rule. Retrying every failure indefinitely is not a reliability plan. Calculation: ((1+2)+4) = 7.
Make a practice plan
- Make a four-row summary, one row for each lesson, with its computing idea and one worked decision.
- Explain one tempting mistake using the actual supplied example.
- Complete the new unit review before consulting its explanations.
- Try the transfer task on paper and compare your evidence against the model response.