System Design Interview Question: Design URL Shortener

  Рет қаралды 4,776

Hayk Simonyan

Hayk Simonyan

Күн бұрын

Designing a scalable and secure URL shortener service like TinyURL or Bitly, planning the system architecture, API design, and key strategies for high availability and security.
Free Web Developers Community and Courses: www.skool.com/web-dev-mastery
• System Design Interview
🔖 Sections
0:00 Introduction
0:53 Functional and Non-functional Requirements
1:18 Clarifying Questions
2:30 Data Estimation
4:36 High-Level System Design
5:24 API Design
7:13 Database: Storing the shortened URLs
8:18 URL Shortener Service
10:19 High Availability & Low Latency
11:20 Database Scaling
12:24 Security Considerations
#systemdesigninterview #designtinyurl #designurlshortener

Пікірлер: 18
@vinoths7140
@vinoths7140 2 күн бұрын
I am grateful for your help in making me understand.
@janakiramankirthivasan5955
@janakiramankirthivasan5955 8 күн бұрын
after watching five different videos , i finally understood the concept from yours . Thank you very much!
@hayk.simonyan
@hayk.simonyan 7 күн бұрын
You're welcome. Glad it helped!
@Coding101-nb5ej
@Coding101-nb5ej 3 ай бұрын
I feel like I should have paid for this level of insights. thank you so much for sharing
@hayk.simonyan
@hayk.simonyan 3 ай бұрын
Glad to hear that
@kzrfaisal
@kzrfaisal 3 ай бұрын
Wooahh....I have watched so many videos on this topic but always loose it in the middle of the video, but you made me stick to the end, the amount of simplicity you brought in system design explanation is commendable. We really need more of these 🙌. THANKS A LOT.
@hayk.simonyan
@hayk.simonyan 3 ай бұрын
Great to hear that!! Expect many more
@vijayansivaraman7923
@vijayansivaraman7923 3 ай бұрын
@Hayk Simonyan, In my 13 years of experience in .Net as as full stack developer, So far i didn't see any other channel explaining this much crisp and clear with animation images to understand better. Kudos to your effort and hardwork. Very much Appreciated. I wish you will get more subscribers and will reach great heights. Can you post videos on Angular, Javascript and .Net 7, EFCore , Azure full tutorials with real time examples ?
@hayk.simonyan
@hayk.simonyan 3 ай бұрын
@vijayansivaraman7923 It's great to hear that you're interested in these topics! Expect more tutorials like this here. I'm not an expert in .Net, but I'm planning to post about JS + frontend frameworks (Angular, React) and cloud providers (Azure, etc.) on this channel
@Aditya-lc5uk
@Aditya-lc5uk 3 ай бұрын
Damn this is some gold content !! Absolutely loved it !!
@hayk.simonyan
@hayk.simonyan 3 ай бұрын
Thank you!!
@passionforsciencel5180
@passionforsciencel5180 Ай бұрын
Hey, I stumbled upon a more efficient approach for the initial step of our URL shortener project. Instead of the traditional method involving database creation and random ID insertion to ensure unpredictability, I devised a single script. This script generates IDs synchronously without relying on a database. It's incredibly memory-efficient (no heap allocation) and adept at handling high traffic seamlessly. The secret? Just a simple mathematical concept. Intrigued? Let me know if you want to dive in! 😊
@hayk.simonyan
@hayk.simonyan Ай бұрын
hey, yes creating all keys upfront will be inefficient. A better approach is to start with a database auto-incrementing integer as your unique identifier for each shortened URL. Then encode this integer into a short alphanumeric string (using base62 or similar techniques) for a compact and user-friendly representation
@passionforsciencel5180
@passionforsciencel5180 Ай бұрын
@hayk.simonyan, I have come across a mathematical concept known as the "Modular Inverse" that could revolutionize the approach to URL shortening, eliminating the need for a database entirely: First, select a large prime number, denoted as 'm', ideally the nearest prime number to the anticipated number of links to be generated over the lifetime of the application. Within your application, initialize a counter, 'i', starting from 2 (1 always return 1) and incrementing up to 'm'. For each incoming request, return the modular inverse of 'i' with respect to 'm'. This operation guarantees unpredictability and non-repetitiveness due to the prime nature of 'm'. Increment 'i' by one after each request. Here's an example with 'm' set to 37: i = 2, result = 19 i = 3, result = 25 i = 4, result = 28 i = 5, result = 37 i = 6, result = 31 i = 7, result = 16 i = 8, result = 14 i = 9, result = 33 i = 10, result = 26 i = 11, result = 27 i = 12, result = 34 i = 13, result = 20 i = 14, result = 8 i = 15, result = 5 i = 16, result = 7 i = 17, result = 34 i = 18, result = 35 i = 19, result = 2 i = 20, result = 13 i also searched about the time complexity of Modular_Inverse function and i get O(log(min(i,m))) . So what you think ? Best regards, Bouzid Kobchi
@hayk.simonyan
@hayk.simonyan Ай бұрын
@@passionforsciencel5180 it's a clever approach 👍 For URL shortening systems where the anticipated scale is known, this inverse method might be a great fit. However, for large scale systems where flexibility, unpredictability, and advanced features such as custom short URLs are expected, a traditional database backed method is likely more suitable
@passionforsciencel5180
@passionforsciencel5180 Ай бұрын
@@hayk.simonyan Anyway, i like to mention it , sometimes mathematicians can replace us 😅 Thanks for your feedback
@ntnmnk2009
@ntnmnk2009 3 ай бұрын
How do you use the two databases, one SQL and another NoSQL? Like what is each database's purpose?
@hayk.simonyan
@hayk.simonyan 3 ай бұрын
Sql database keeps track of the available keys, and Nosql is the primary database that stores the shortened URLs and their metadata
System Design: Design a URL Shortener like TinyURL
16:00
Code Tour
Рет қаралды 80 М.
бесит старшая сестра!? #роблокс #анимация #мем
00:58
КРУТОЙ ПАПА на
Рет қаралды 3,4 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 11 МЛН
Sigma Girl Past #funny #sigma #viral
00:20
CRAZY GREAPA
Рет қаралды 30 МЛН
System Design Interview Concepts [FULL TUTORIAL]
53:52
Hayk Simonyan
Рет қаралды 12 М.
System Design Interview Question: Design Spotify
5:47
Hayk Simonyan
Рет қаралды 5 М.
System Design Interview: Design WhatsApp
7:22
Hayk Simonyan
Рет қаралды 5 М.
Design a Data Warehouse | System Design
14:08
Interview Pen
Рет қаралды 18 М.
Event-Driven Architecture (EDA) vs Request/Response (RR)
12:00
Confluent
Рет қаралды 119 М.
URL shortener system design | tinyurl system design | bitly system design
34:39
Tech Dummies Narendra L
Рет қаралды 454 М.
API Design 101: From Basics to Best Practices
5:39
Hayk Simonyan
Рет қаралды 18 М.
How to Crack Any System Design Interview
8:19
ByteByteGo
Рет қаралды 323 М.
System Design Interview Walkthrough: Design Twitter
23:04
Hello Interview - Tech Interview Preparation
Рет қаралды 22 М.
How to implement TinyURL (System Design Interview)
17:45
KA Education
Рет қаралды 75 М.
бесит старшая сестра!? #роблокс #анимация #мем
00:58
КРУТОЙ ПАПА на
Рет қаралды 3,4 МЛН