System Design Interview

Understand the Problem

Scope 2 min readLesson 1 of 4

In this chapter we explore the design of a chat system. Almost everyone uses a chat app. Figure 1 shows some of the most popular apps in the marketplace.

Figure 1

A chat app performs different functions for different people. It is extremely important to nail down the exact requirements. For example, you do not want to design a system that focuses on group chat when the interviewer has one-on-one chat in mind. It is important to explore the feature requirements.

Step 1 – Understand the problem and establish design scope

It is vital to agree on the type of chat app to design. In the marketplace, there are one-on-one chat apps like Facebook Messenger, WeChat, and WhatsApp, office chat apps that focus on group chat like Slack, or game chat apps, like Discord, that focus on large group interaction and low voice chat latency.

The first set of clarification questions should nail down what the interviewer has in mind exactly when she asks you to design a chat system. At the very least, figure out if you should focus on a one-on-one chat or group chat app. Some questions you might ask are as follows:

Clarifying the scope
Candidate

What kind of chat app shall we design? 1 on 1 or group based?

Interviewer

It should support both 1 on 1 and group chat.

Candidate

Is this a mobile app? Or a web app? Or both?

Interviewer

Both.

Candidate

What is the scale of this app? A startup app or massive scale?

Interviewer

It should support 50 million daily active users (DAU).

Candidate

For group chat, what is the group member limit?

Interviewer

A maximum of 100 people

Candidate

What features are important for the chat app? Can it support attachment?

Interviewer

1 on 1 chat, group chat, online indicator. The system only supports text messages.

Candidate

Is there a message size limit?

Interviewer

Yes, text length should be less than 100,000 characters long.

Candidate

Is end-to-end encryption required?

Interviewer

Not required for now but we will discuss that if time allows.

Candidate

How long shall we store the chat history?

Interviewer

Forever.

In the chapter, we focus on designing a chat app like Facebook messenger, with an emphasis on the following features:

  • A one-on-one chat with low delivery latency

  • Small group chat (max of 100 people)

  • Online presence

  • Multiple device support. The same account can be logged in to multiple accounts at the same time.

  • Push notifications

It is also important to agree on the design scale. We will design a system that supports 50 million DAU.

Finished reading?

Mark it complete to track your progress.