How to Approach System Design Questions during Interview?

System design questions are popular during a tech round of an interview at top tech companies and large-scale tech startups. These types of interviews are open-ended conversations where candidates are expected to take the lead and guide the discussion with the interviewer. In this blog, we will discuss critical steps that candidates can follow to solve system design questions during interviews.

Step 1: Requirements clarifications

Since system design questions are often open-ended and do not have a single correct answer, it is important to ask questions and clarify any ambiguities early in the interview process. Candidates who take time to understand the end goals of the system are more likely to be successful.

To gather requirements and understand the scope of the problem, one can ask such questions:

  • Who will be using the system?
  • How will they be using it?
  • How many users are there?
  • What does the system do?
  • What are the inputs and outputs of the system?
  • How much data is expected to be handled?
  • How many requests per second are expected?
  • What is the expected read-to-write ratio?

Step 2: Back-of-the-envelope estimation

When designing a system, it is important to understand the system scale. We need to consider factors like read-to-write ratio, number of concurrent requests, number of monthly users, number of daily active users, required storage capacity, bandwidth requirements, etc. Once discussing these factors with the interviewer, you can start to think about the ways to design a system that can work well at scale.

Step 3: Create a high-level design

To initiate the high-level design process, we need to identify all critical components and attempt to draw a diagram representing the interaction of these components to fulfil both functional and non-functional requirements. Here, components can include different clients, backend services, data stores, cache systems, load balancers, CDNs, message queues, batch processing systems, etc.

By outlining the interaction of key components, you can better explain the overall structure of the system and how various components will collaborate to achieve the desired results. This can help ensure that your design aligns with all the requirements and constraints of the problem.

High level design of web crawler

Step 4: Database Design

Defining how data will be processed is a crucial step in solving system design questions, especially when building scalable and efficient systems. We need to understand the type of data that needs to be stored, the relationships between different types of data, the expected workload (read-heavy, write-heavy, or balanced), how data will flow through the system, etc.

Based on the various properties and data access patterns, we need to identify the appropriate database systems (relational or non-relational) that best fit the given requirements. You can try to explore this blog: SQL vs NoSQL Comparison.

Types of databases used in system design process

Step 5: Design core components

Once you have outlined the high-level structure of the system, then it's time to discuss the major components in more detail. At this stage, interviewer input can often help guide you to parts of the system that need more attention. It is important to present various approaches, benefits, and drawbacks of each option and justify why you have chosen a particular approach. For example, if you were asked to design Tiny-URL, then discuss these things:

Generating and storing a hash of the full URL

  • MD5 and Base62
  • Hash collisions
  • SQL or NoSQL
  • Database schema

Translating a hashed URL to the full URL

  • Database lookup
  • API and object-oriented design

Step 6: Scale the design

To ensure that your system can meet the scale requirements of the problem, we can use ideas like load balancing, horizontal scaling, cachingdatabase shardingreplication, etc. to address scalability issues. By considering these options and determining which are most appropriate for your system, you can ensure that your design can handle the expected workload and meet the needs of your users.

Step 7: Identifying and resolving bottlenecks

To ensure that system is robust and able to handle unexpected challenges, it is important to discuss as many potential bottlenecks as possible and consider different approaches to mitigate them.

  • Is there any single point of failure? What steps can be taken to mitigate this?
  • Are there enough replicas of data to ensure that users can still be served if a few servers are down?
  • Are there enough copies of different services running to ensure that a few failures will not cause a total system shutdown?
  • How is the performance of the service being monitored? Are there alerts in place to notify the team when critical components fail or their performance degrades?

System design questions to practice the steps

If you have any queries or feedback, please write us at contact@enjoyalgorithms.com. Enjoy learning, Enjoy system design!

More from EnjoyAlgorithms

Self-paced Courses and Blogs