Eileen Pangu
6 min readDec 21, 2019

--

System Design Interview: URL Shortener

Design a URL shortener service like tinyurl.com. It is one of the most commonly asked system design interview questions. There are numerous resources online. My design is by no means the best or most complete. But I think I can offer my thought process from a different angle. After all, there is no one right answer to a system design question. It’s all about focus, tradeoff, and preference. Let’s dive right in.

Requirements

For any system design, as always, let’s clarify who are the users and what they are trying to accomplish with the system. Let’s suppose the user is a typical internet user who has a super long and crappy URL, and wants to store or share a much shorter and cleaner version of it. Now she needs a service (probably a website) through which she can create an association between the long URL and its shortened version. For simplicity, we’ll assume that besides registering the association, the only other function of this service is to return an HTTP Redirect to the original URL when receiving a Get request of the shortened one.

A Simplistic Design

OK, this sounds simple enough. Let’s map out the technicality behind that user journey. The service has a webpage that allows users to input the original URL in a text box, and a submit button, when clicked, sends the original URL via an HTTP Post to the service’s backend. Once the backend receives the original URL, it creates a hash of it. In the case of hash collision, the backend may choose to add a random…

--

--

Eileen Pangu
Eileen Pangu

Written by Eileen Pangu

Manager and Tech Lead @ FANG. Enthusiastic tech generalist. Enjoy distilling wisdom from experiences. Believe in that learning is a lifelong journey.

Responses (1)