9 Oct, 2023.
URL shortner:
- Shortening the longer URL in shorter one.
- Redirect.
- No of years, 10.
- x request per minutes, 5 request
- Read vs write??
- 80% read and 20% write.
- 1 request per minute *
Use it to share thoughts and resources, such as:
- Features scope
- API design
- Pseudo code for specific components
- Data model/schema
- Back-of-the-envelope calculations
- Reference links
- Link to whiteboard or diagram such as https://sketchboard.me/new
URL-Shortener
URL Shortening services (e.g. bit.ly or tinyurl) take a long URL string and create shorter URL versions that redirect to the long URL.
Design a URL Shortener service.
This editor is synced in real time with your peer.
Use it to share thoughts and resources, such as:
- Features scope
- API design
- Pseudo code for specific components
- Data model/schema
- Back-of-the-envelope calculations
- Reference links
- Link to whiteboard or diagram such as https://sketchboard.me/new
Good luck!
Lets say 5 requests per minute NF 80% 20%
Candidate (me):
- 1 write request per minute * 60 * 24 * 365 * 10 (10 year is target) - y req.
- 26 English
- log??
Interviewing candidate: Tiktok (Modita)
This editor is synced in real time with your peer.
Use it to share thoughts and resources, such as:
- Features scope
- API design
- Pseudo code for specific components
- Data model/schema
- Back-of-the-envelope calculations
- Reference links
- Link to whiteboard or diagram such as https://sketchboard.me/new
Good luck!
Features
- Register opening account
- Log in
- Upload
- News Feed
- Like Video
- Comment on Video
- Bookmarks
Non Functional
- 1 million daily active user
- Uploading?? 20K users uploading ⇒ Read heavy
- Available
- Less latency
APIs
- RegisterUser POST API
- GetUserInfo GET API
- Upload Content
- AccessNews Feed
News Feed User -⇒ LB -⇒ NewsFeedService -⇒ DB (U1 ⇒ List Users) MySQL -⇒ Fecth data from CDN -⇒ Amazon S3 -⇒ Redis Cache
User User Name ID Location Followers -⇒
Sharding? what data ⇒ User -⇒ Ho MySQL Master Slave Slave
DB -⇒ Normalised Keys
Geo Routing -⇒ WebServer —⇒ CDN
Load NewFeed_1
User
Load -⇒ Hashing
User 1 -100 NewFeed1
100-200 NewsFeed2
Round Robin Fashion
Caching Caching the User info etc following field etc Redis cache to cache the TimeLine aswell
Fault Tolerance ⇒ heartbeat? pricing? partition t. →
Least Recently User Or FIFO Video Duplication ⇒ Server Processing -⇒ broken chunks -⇒ Generate a Hash video -⇒