Home

Table of Contents
- [Overview:](#overview)
    - [Approaches to system design in an interview:](#approaches-to-system-design-in-an-interview)
    - [List of System Design Topics:](#list-of-system-design-topics)
    - [References:](#references)

Overview:

Scalability is the property of a system to handle growing amount of traffic. The scaled program with client-server will act as an online service.

I the case the program is scaled offline, it is known as batch processing

When the input is not fixed and comes as a stream, it is known as Stream Processing.

Approaches to system design in an interview:

  • Step 1: Gather system requirements

    1. Gather Functional Requirements

      • Detailed Problem Statement
      • Describe user’s view of the system in plain English
      • Shows that you can communicate and unpack an open-ended problem
      • Ask clarifying questions
      • Main players, their actions, results etc.
    2. Design Constraints and Scalability Requirements (Technical requirements)

      • Number of users, transactions per second etc.
      • The interviewer may give them or may ask the candidate
      • Can be collected at a later step as well
      • CP or AP etc
  • Step 2: Micro services

    • Take the functional requirement and write them as user stories
    • Group these user stories to similar business objects
    • These become microservices (call them after business objects such as picture service, file service etc)
  • Step 3: Draw Logical Diagram

    • Image of hte microservices connected using arrows.
    • Shows how data flows through the system
  • Step 4: Pick one or two micro services and do a deep dive into them

    • Talk about application tier, storage tier and cache tier
    • Explain how it works for single user single system, single request.
  • Step 5: Scale the application, storage and cache tier

  • Step 6: IF time permits, make final proposal

    • Go back to the logical diagram and summarize the microservices.

Microservices

  • independently depoloyable service modeled around a business domain

  • Each one is a blackbox for other microservices

  • They communicate using language independent APIS like REST or HTTP

  • Small and focused on doing one thing

  • To define microservices,

    • cluster the requirements such that each cluster can be handled indpendentlhyby a different eam

    • Rule of thumb is if API and data of two functional requirements, do not look the same, then they belown got two different microservices

    • This should tell us if it is a depth oriented problem (1 microservice) or breadth oriented problem ( many microservices

    • Always the system has profile, analytics and authentication micro services but do not spend time on these Unless the interview is for one of these teams

  • Architecture:

    • Each microservice has upto 3 tiers:
      • Backend tier or business logic (App Server) - Where the code goes
      • Cache tier for faster resposne time (Cache) - subset of database tier
      • Storage tier for data storage and retrieval (Database) - Store in row-major or col major or files (for unstructured data)

Step 1: Wear the product Management Hat:

  • Treat interviewer as an end-user/customer

  • Collect Functional Requirements (max 5 to 6 minutes)

    • Detailed problem statement
    • High level
    • Spend a few minutes to show that youc an communicate given an unknown problem
    • The idea is to visualize APIs from the requirements
  • Collect design constraints

    • Numbers, how many, how much
    • Required for answering scalability
    • Often interviewers throw these back to the candidate, so it is beneficial to reseach on them.
    • Can be collected at a later step

List of System Design Topics:

  • Design a Cache (single Server)
  • Design a distributed Cache
  • Design a URL shortner
  • Design Chat (Messenger) server
  • Design NetFlix streaming service
  • Design Photo Sharing
  • Design Twitter
  • Design Recommendation System
  • Design Unique ID generator
  • Design Request Counters (hit Counters)
  • Design E-commerce website
  • Design Recently viewed items
  • Design Social Gaming
  • Design Log Search
  • Design Google Maps
  • Design API Rate Limiter
  • Design Web Crawler
  • Design Ticket Master

Stream Processing Examples:

  • Uber has some stream processing
  • In financial world, stock trading is an example
  • IOT uses stream processing
  • Logging

References:

Blogs and Papers:

  1. Designing online game system
  2. Engineering MLOps
  3. System Design Donne Martin
  4. Designing a Web crawler
  5. System Design Tutorial from freecodecamp
  6. Patterns of Distributed System
  7. System Design for Twitter - Narendra
  8. Strategies for heavy write DB
  9. The Google File System - Paper
  10. How to do Distributed Locking - Martin Kleppman
  11. Apache Samsa
  12. A comparision of data stores for online feature store
  13. Database Caching Strategies using Redis
  14. System Design Interview Twitter or Facebook Feed
  15. What to look for in a code review
  16. How to build an exchanges
  17. SRE Classroom Google
  18. ML system design architecture
  19. Uber Data Management
  20. Senior Engineer Interviews
  21. Airbnb-Microservices architecture

Books:

  1. Foundations of Scalable Systems
  2. Designing Machine Learning Systems
  3. Building Secure and reliable systems
  4. The Site reliability Workbook
  5. Site Reliability Engineering

Youtube Channels:

  1. System Design Interview Channel
  2. Narendra’s videos on System Design
  3. SDE Skills channel on System design
  4. AirBNB Hotel Booking Design
  5. Work With Googler YT channel
  6. Distributed Systems - Lectures by Martin Kleppman
  7. Streaming a million likes - InfoQ YT channel
  8. Papers we love YT channel - Chubby Lock Service
  9. MIT Distributed System Lecture Series
  10. Scaling HOTSTAR for 25 million concurrent users
  11. Building a real time metrics database at datadog
  12. System Design Interview Prep Exponent YT channel
  13. System Design Tushar Rao Channel

Github Channels:

  1. https://github.com/codersguild/System-Design
  2. ML System Design
  3. Awesome Rec-sys
  4. System Design

Linkedin List:

Courses:

  1. Grokking Advanced System Design Interview