1. Storage layer — what database and why? Write the core schema (table name, columns, types).
Think: read vs write ratio, query pattern (lookup by code), durability requirements.
2. Code generation — how do you generate the short code (e.g. "aB3xK9")? What happens if two users shorten different URLs at the same moment?
Options: random, hash of URL, global counter. Consider collision probability and concurrent writes.
3. Read path — how do you serve 10,000 redirects/second without the database becoming the bottleneck?
At 10k RPS, where does each request go? DB alone won't survive this. What sits in front of it?
4. Failure mode — what breaks first when traffic spikes 10x (to 100,000 redirects/second)? How do you handle it?
Trace a request from browser to database. Which component hits its limit first? What's your mitigation?
0 of 4 answered