9 Oct, 2023.

URL shortner:

functional_requirement

  • Shortening the longer URL in shorter one.
  • Redirect.
  • No of years, 10.

non_functional_requirement

  • 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

  1. Register opening account
  2. Log in
  3. Upload
  4. News Feed
  5. Like Video
  6. Comment on Video
  7. Bookmarks

Non Functional

  1. 1 million daily active user
  2. Uploading?? 20K users uploading Read heavy
  3. Available
  4. Less latency

APIs

  1. RegisterUser POST API
  2. GetUserInfo GET API
  3. Upload Content
  4. 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 -