-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
System Design Guide for Software Professionals
By :
In this section, we will explore solution options, bottlenecks, problems, mitigations, and high-level architecture diagrams. First, let’s start with identifying what the core challenge here is.
The core challenge in this design problem is as follows: how do we generate unique URLs? There can be various solutions. Let’s explore one at a time and see what are the pros and cons of each one and let’s arrive at the most suitable one.
Given a long URL, generate a random short URL and check whether exists in the database (DB). If it exists, then generate another random URL and keep doing it until we find that the entry doesn’t exist. If it doesn’t exist, then store this new entry in the DB as a key-value pair: {short_url -> long_url}.
There are a few problems with this approach:
Change the font size
Change margin width
Change background colour