Create short links, resolve them quickly and handle expiry without sending users to the wrong destination.
Backend and product engineers designing software behavior.
Your approach: Use diagrams, tables or prose for customer contracts, state transitions and data ownership; include APIs only to the depth the question requests.
Design a URL shortener that creates links and redirects visitors to their original destination. Define the create and redirect contracts, how short codes remain unique, and how expiry and deletion affect cached redirects. Explain one failure from the visitor’s perspective.
State a p95 server response target, excluding the destination website and internet transit.
Required target: ≤ 100 milliseconds
Concurrent creates and retries must not assign one short code to two different destinations.
State a bounded delay for invalidating redirects and how clients see expired or deleted links.
Define link creation, redirect and deletion responses, identifiers and ownership.
Show durable link storage, code allocation and the redirect cache.
Estimate average and peak redirect QPS and one year of storage with stated record size.
Trace a duplicate create and a cache outage; compare two ways to allocate codes.