URL Shortener & Link Management Service · View 15 of 23 · Runtime
Why a conditional create
- Two clients asking for the same alias in the same millisecond must produce exactly one winner. A read-then-write cannot guarantee that; a conditional create against a single write region can (ADR-05).
- The loser receives a 409 naming the collision. The platform never substitutes a generated code for a requested alias — that link would be printed and then be wrong.
- The reservation is checked against retired codes too, so a code that once existed can never be claimed again (ADR-04).
The order of operations
- Idempotency check → validation → screening → claim → write → respond. Screening precedes the claim so a blocked destination never consumes a code.
- Creation p99 ≤ 250 ms including the claim; bulk import of 10,000 links p99 ≤ 60 s as an asynchronous job.
- Pre-warming starts from the change feed immediately: resolvable in the creating region within 1 s p99, globally within 10 s p99.
Risks
- A single write region means creation is unavailable during a regional failover (RTO ≤ 5 min). The requirement accepts refusing creation over risking two winners.
- Random 7-character codes need a collision retry as the table fills. At 12 billion links in a 3.5 × 10¹² space the retry rate is negligible; at 500 billion it is not, and lengthening is the planned answer (ADR-03).