System Design Basic 4 - The Framework to breakdown system design questions

The Framework to breakdown system design questions

  1. You and the other guy work together to solve a real-life problem to meet their goals.
  2. Technical skill, collaborate, work under pressure, resolve ambiguity constructively , ask good questions.
  3. Do not ignore trade offs and care about cost.

4-step process

1. Understand the problem and deign scope

  1. DO NOT give an answer quickly without clarify the requirements and assumptions.

  2. Ask good questions. Questions to understand the exact requirements.

  3. Write down you assumptions or their answers.

    • What specific features are we going to build?
    • How many users does the product have?
    • How fast does the company anticipate to scale up? What are the anticipated scales in 3 months, 6 months, and a year?
    • What is the company’s technology stack? What existing services you might leverage to simplify the design?

2. Propose high-level design and get buy-in

  1. Develop a high-level design and reach an agreement with the interviewer.
  2. Ask feedback when you come up with a blueprint. Communicate with interviewer.
  3. Draw diagrams with key components on paper. Clients(web/mobile), APIs, web servers, data stores, cache, CDN, message queue, etc.
  4. Do calculations to evaluate the system fits the scale constraint. Communicate with interviewer.
  5. Go through a few concrete cases helps you frame and pick the missing part.
  6. Whether to include the endpoints and database schema depend the problem. Communicate with the other guy.
Example - Design a news feed system
  1. At high level, the system is designed into two flows: feed publishing and news feed building.

    1. Feed publishing: when a user post, corresponding data is written into cache/ database, and the post will be populated to their friends' feed.
    2. Newsfeed building: aggregating friends post in chronological order.
    image-20230310152449907
image-20230310152523931

3. System Deep Dive

  1. At this point, you and your interviews should already achieved:
  • Agreed on the overall goals and feature scope
  • Sketched a high level blueprint for the overall design
  • Obtained feedback for the high-level design
  • Some initial ideas about areas to focus
  1. Time management is important and do not dive in complicated algorithms.
Example - Focus area(topic)
  1. Feed publishing

    image-20230310153219492
  2. News feed retrieval

4. Wrap up

  1. A few follow up questions may be discussed
    • Identify the system bottleneck and potential improvements; there is ALWAYS something to improve upon.
    • Give a recap of you whole design;
    • Error cases(server failure, network loss, etc);
    • Operation issues are worth mentioning. Monitoring, metrics, logs...
    • How to handle the next level scale curve;...
    • ...
  2. Dos
    • Always ask for clarification. Do not assume something by your self.
    • Understand the problem. Startup and Huge company needs different solution.
    • Let interviewer know you are thinking. Speak out.
    • Suggest multiple choices.
    • Once agree on blueprint, go into details on each component. Most critical first.
    • Get ideas from interviewer if they have;
    • Never give up
  3. Don'ts
    • Do not be unprepared for typical interview questions.
    • Do not jump into solution without clarifying the requirements and problem and constrains.
    • Do not go too much detail on a single component in the beginning. Get the high-level design first.
    • Communicate, do not think in silence.
    • If you get stuck, ask.
    • Do not think your interview is done once you give the design. You are not done until your interviewer says you are done. Ask feedback early and often.

Time allocation on each step

Normally the session will be 45 min.

Step1 Understand the problem and clarify requirements and scope: 3-10min;

Step2 Propose high-level design: 10-15min;

Step3 Deep dive: 10-25min;

Step4: Wrap: 3-5min