Design a url shortner

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae
Search for a command to run...

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae
We will run though the design of actual distributed systems and concepts, abridged and modernized. [Photo by Med Badr Chemmaoui via unsplash]
Here is a summary / cliff’s notes of the Domain Driven Design Quickly eBook Domain is what you trying to encode for which is owned by domain experts/specialist of the area The domain model is an abs
Isolation is part of a database's ACID guarantees. It ensures that concurrent transactions don't affect each other. The goal is to maintain the state of the data as if transactions are run serially. H

You Should Tell Yourself

Listening to the Mel Robbins's podcast on regrets was a 'ear'-opener. One can have reqrets of action or inaction. 4 types of reqrets foundation - should've done the work boldness - should've taken t

We need to create a unique ID generator for our high-traffic web application, generating about 10K IDs/second. The IDs can't simply be monotonically increasing integers, which are good for data access
A URL shortener is a proxy service that provides a mapping between the short and full representation of a URL. The short URL has the advantage of being small. The service can also provide useful analytics.
The API provides two endpoints:
POST /api/v1/data/shorten payload: { url: string }GET /api/v1/{shortUrl}Assume
100M writes / day
With ~100K seconds a day
= ~1K writes / second
Assuming a typical 10:1 read:write ratio
= ~10K reads / second
We'd need to cache.
Having
100M records / day
at 100 bytes per record is
~= 1 GB / day ~= 400 GB / year
301 — permanent, where the browser caches subsequent requests and reduces load.302 — temporary, where the browser's requests always query the service first, which is useful for analytics.Why base62? With 62 characters [a-zA-Z0-9], a 7-character short code covers 62^7 ~= 3.5T URLs — plenty of headroom for the storage estimate above.
Happy Hackin'!
This article is part of the system design series where I am summarizing chapters from The System Design Interview: Volume 1 / Volume 2 amongst other related content