Design a URL Shortener
This is your first full design, step by step, like in a placement interview. You will design a service that turns a very long link into a short one. You will use the same eight steps for any system design question.
New words
- Requirement
- Something the system must do, or a limit it must keep.
- QPS
- Queries per second: how many requests reach your system each second.
- Base62
- A way to write a number using 62 symbols: 0-9, A-Z and a-z.
- Redirect
- A reply that tells the browser to go to a different link.
- Cache
- A small, fast store for answers that people ask for again and again.
- Replica
- A copy of the database that is used to answer read requests.
- Single point of failure
- One part that, if it breaks, stops the whole system.
What you will learn
- The problem: a very long link
- Step 1: Requirements
- Step 2: Small estimates
- Step 3 and 4: The API and the data
- Step 5: Making the short code
- Try it: a working URL shortener
- Step 6: The design
- Step 7: Growing the system
- Step 8: What can go wrong?
- Trade-offs in this design
- In a real system
- Interview tip
- Key takeaways
10 quiz questions at the end.
The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.