Recent Posts

Become a high performing team with well-crafted OKRs

Increase productivity and collaboration with Slack

I’ll try to keep my reading list up-to-date

Designing a simple service

Let’s figure out how to generate the short url of length less than 10 characters (after http://sho.rt/) before doing extensive analysis.

We will break this down into a few operations:

  1. Generation of a unique id
  2. Mapping of the id into a short url that is less than 10 characters
  3. Storage and retrieval of the id and long url

Come up with several designs that can satisfy these operations.

Analysis

Let’s start with the shared-nothing id generation (generate id in client at the App layer) since it would appear to be the most scalable.

Design1

Application design limits

We would need to generate a unique key for each request for a long url to be made short. The easiest way of doing so would be to generate an md5/sha/uuid of the long url, then we would map and encode the key and store it.