educative.io

Educative

About the number of unique short URLs

In the storage calculation of this problem, it is stated that:

Storage estimates: Let’s assume we store every URL shortening request (and associated shortened link) for 5 years. Since we expect to have 500M new URLs every month, the total number of objects we expect to store will be 30 billion:

500 million * 5 years * 12 months = 30 billion

So that would be 30B URLs in 5 years.

But then, when talking about encoding the original URL, it says:

With 68.7B unique strings, let’s assume six letter keys would suffice for our system.

So the system would be able to run for only ~10 years? Because after 10 years we would have used ~60B unique short URLs.

Thank you in advance.

This one did not make sense to me either at first. I thought, is this suggesting after 5 years, we can delete all the URLs including the ones that were just created at 11:59 PM before the end of the 5 years? Surely we won’t want to do that and we will be getting more URLs after that. But I guess it was just talking about budgeting storage for 5 years.

Similarly, perhaps the unique strings would just be enough for the first 10 years. And afterwards, more characters would be needed?

Hi, When explaining Encoding actual URL it is mentioned that it is one of the solutions for Basic System Design and when talking about With 68.7B unique strings, let’s assume six letter keys would suffice for our system, it also explains that We have a couple of problems with our encoding scheme at the same time. So , don’t compare the Storage estimates with 68.7B unique strings.
Hope it will help, Thank you :blush: