The Interview Template: Six Steps

The interview template defines the sequence of steps for a system design interview. It applies to most interviews below the staff level at medium and large companies. The master template provides the parts of a design. This template sets the order for building and presenting it.

These times show a typical split for a 45-minute interview rather than a fixed rule. The interviewer can move faster through the early steps to leave more time for the deep dives.

1. Functional Requirements

Functional requirements define the features that the system must provide. The interview question names the product, but not its scope. Ask questions to fix the scope before designing:

  • Which features must this design include, and which are out of scope?
  • Which features already exist in other services that this system can call?
  • Who are the users, and what do they do most often?

Write the agreed features as a short list. Each later step refers back to it. For "Design Twitter," this list could include posting a tweet, following a user, and viewing a home timeline.

2. Non-functional Requirements

Non-functional requirements define how well the system must work. They decide most of the design. Discuss the requirements that matter for the specific problem:

  • Scalability: how many users and how much data the system must handle.
  • Availability: how much downtime is acceptable. Most products need to stay up during the failure of a machine.
  • Latency: how fast responses must be. A collaborative editor needs a fast response; a file backup can be slower.
  • Consistency: whether every read must return the latest write, or whether a short delay is acceptable.
  • Durability: whether any data loss is acceptable.

Other requirements, such as privacy rules for personal data, can also matter for some problems. State each requirement in the context of the problem. "Timelines can be a few seconds out of date, but a posted tweet must never be lost" is more useful than "eventual consistency." The Non-functional Requirements lesson covers each one.

The diagram shows how each requirement for Twitter, stated in context, points to a design choice in the later steps.

Grasping the building blocks ("the lego pieces")

This part of the guide will focus on the various components that are often used to construct a system (the building blocks), and the design templates that provide a framework for structuring these blocks.

Core Building blocks

At the bare minimum you should know the core building blocks of system design

  • Scaling stateless services with load balancing
  • Scaling database reads with replication and caching
  • Scaling database writes with partition (aka sharding)
  • Scaling data flow with message queues

System Design Template

With these building blocks, you will be able to apply our template to solve many system design problems. We will dive into the details in the Design Template section. Here’s a sneak peak:

System Design Template

Additional Building Blocks

Additionally, you will want to understand these concepts

  • Processing large amount of data (aka “big data”) with batch and stream processing
    • Particularly useful for solving data-intensive problems such as designing an analytics app
  • Achieving consistency across services using distribution transaction or event sourcing
    • Particularly useful for solving problems that require strict transactions such as designing financial apps
  • Full text search: full-text index
  • Storing data for the long term: data warehousing

On top of these, there are ad hoc knowledge you would want to know tailored to certain problems. For example, geohashing for designing location-based services like Yelp or Uber, operational transform to solve problems like designing Google Doc. You can learn these these on a case-by-case basis. System design interviews are supposed to test your general design skills and not specific knowledge.

Working through problems and building solutions using the building blocks

Finally, we have a series of practical problems for you to work through. You can find the problem in /problems. This hands-on practice will not only help you apply the principles learned but will also enhance your understanding of how to use the building blocks to construct effective solutions. The list of questions grow. We are actively adding more questions to the list.

Sign up for free to read the full article