caffkane

System Design Questions to ask

· Logan Kane

Fair warning, this is a long one. Brew a pot of coffee (or tea!) and read on.

This page is about questions to ask in a system design interview, not answers. In general, we should ask these questions. Be careful to ask questions, but not dive to deep into a topic if you don’t know the answers. Topics can become very deep when tackling distributed systems.

Gathering requirements

At this stage we want to gather requirements so that we have a better understanding of the system we’re designing.

Functional requirements

Non-functional requirements

Availability and consistency requirements

Response time and latency constraints

Define API

High level diagrams

After getting answers to these final questions, here is where we should create a high level diagram. This high level diagram should be designed quickly to move onto to diving into the choices around this diagram. Having a concrete diagram drawn up allows for discussion around our choices and preventing flip-flopping on choices. This is a great chance to showcase a very presentable diagram. Don’t try to use vendor specific images, instead rely on generic names. (e.g. generic DB photo instead of AWS RDS/Aurora)

Data model and schema

Here we define how we are going to store our data in our data store of choice. We make tradeoffs based on schema/schemaless. Some good questions to ask are: Do we have all the entities we need here? Is anything missing? How are going to identify the key properties of each entity? We should identify the relationships between these entities. Talk about how normalized our database should be if we chose a relational data store. The more normalized it is, the less performance, but the less redundancy we have in our data.

Deep dive design

This is where we scale up the design. We should have numbers already (5 million users etc.) We want to be asking these questions but also be providing answers for these questions. All of these questions asked could be fair game depending on what you mention.

The following are questions you may be asked, and if not you should ask and answer them yourself.

Addendum:

Creating deadlocks

-- client 1
begin transaction; insert into test values (20); insert into test values (21);
-- client 2
begin transaction; insert into test values (21); insert into test values (20);

-- This creates an exclusive lock on 20. Client 1 hasn’t committed yet.
-- There is an exclusive lock on 21 as well. Client 2 hasn’t committed yet.
-- Both are waiting for each other and it creates a deadlock.
-- The last one to enter the deadlock will be the one to fail

#system-design #writing