Estimates and calculations
For calculations, let’s start by asking some questions:
- What characters can we use for short URLs? Our options are as follows:
- a-z, A-Z, 0-9. So, it’s 62 characters.
- If you want to use more characters,
-
,.
,_
, and~
, so, there’s a total of 66 characters. - Let’s stick to just 62 characters.
- What’s the scale we are operating at? Let’s make some assumptions here:
- We have 1 B users.
- About 10% create short URLs (100 M users).
- Each user creates 1 URL per day, so 100 M URLs per day.
- We store these URLs for 10 years. So,
100 M * 1 * 365 * 10 = 365
B URLs.
- How many characters would we have in the short URL? Now, to have 365 B unique URLs, how many characters do we need to create unique URLs? Let’s see:
- The number of URLs if we use 6 characters is
62^6 = 56
B URLs, but our requirement is to have 365 B URLs. So, we need to use more characters. - If we use 7 characters, we have
62^7 =
3.5
T.
- The number of URLs if we use 6 characters is
- How much storage do...