Skip to content

← Interview Arena

Design a URL shortener

Design a URL shortener

The Arena needs JavaScript to run an interview.

Design a URL shortener: a user submits a long URL and gets a short link, and anyone who opens the short link is redirected to the long one. Work through the stages in order, as you would on a whiteboard: requirements, numbers, architecture, scaling, consistency, reliability, failure and trade-offs.

Key facts

New links
100 million a month
Redirects
About 100 for each link created
Retention
5 years
Peak
Assume the busiest moment is 2.5 times the average
Row size
About 500 bytes a link, index included
One database
An indexed lookup takes about 5 ms, 4 at a time

Constraints

  • Custom aliases, click statistics and abuse checks are out of scope unless you choose to cover them.
  • The service runs in one region.
  • The figures are illustrative targets for this exercise, not measurements of a real service.

Suggested time per stage

  1. Requirements05:00
  2. Estimation06:00
  3. Architecture10:00
  4. Scaling06:00
  5. Consistency04:00
  6. Reliability04:00
  7. Failure scenarios05:00
  8. Trade-offs05:00
Mode

You can pause the clock, nothing is locked, and running out of time is only shown.

The clock cannot be paused. At zero, the stage you are on is locked as written and the stages after it score zero.

Length

Built by GhaziAlibi.

© ShardCraft. All rights reserved.