System Design Template / Approaches Flashcards

Learn patterns for how to approach system design

1
Q

What are the 6 sections for system I need to include?

A

(1) Feature Expectations (5 min)
(2) Performance Estimations (5 min)
(3) Design Goals (5 min)
(4) High level design - core building blocks (5-10 min)
(5) Design Deep Dive (important sections) (15-20 min)
(6) Justify Design (5 min)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What should you cover in feature expectations?

A

(1) Use cases
(2) Scenarios that will not be covered
(3) Who will use
(4) How many will use
(5) Usage patterns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What should you cover in performance estimations?

A

(1) Throughput (QPS for read and write queries)
(2) Latency expected from the system (for read and write queries)
(3) Read/Write ratio
(4) Traffic estimates
- Write (QPS, Volume of data)
- Read (QPS, Volume of data)
(5) Storage estimates
(6) Memory estimates
- If we are using a cache, what is the kind of data we want to store in cache
- How much RAM and how many machines do we need for us to achieve this ?
- Amount of data you want to store in disk/ssd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What should you cover in design goals?

A

(1) Latency and Throughput requirements
(2) Consistency vs Availability [Weak/strong/eventual => consistency | Failover/replication => availability]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What should you cover in High Level Design?Q

A

You should define the core components of the system here from a high level:

    (1) APIs for Read/Write scenarios for crucial components
    (2) Database schema
    (3) Basic algorithm
    (4) High level design for Read/Write scenario
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What should you cover in the design deep dive?

A

You should dive deep on a core feature of the system (ask the interviewer to determine what)

Cover the following:

  1. How to scale the algorithm
  2. Scaling the individual components - availability, scalability, consistency of each component (consistency and availability patterns)
  3. Cover the following components and how they would fit in:
    - DNS
    - CDN (push vs pull)
    - Load balancers (where to use them, active/passive, algorithm, layer 4 or 7)
    - Reverse proxy
    - Application layer scaling (microservices, service directory, etc.)
  • Database approach
    -> Relational vs NoSQL
    -> High level schemas for data and tables
    -> RDBMS -> master-slave, master-master, federation, sharding, Denormalization, SQL tuning
    -> or NoSQL -> Key-value, wide column, Graph, Document, Fast lookups (

RAM -> Redis, Memcached
AP -> Cassandra, RIAK, Voldemort
CP -> Hbase, Mongo, Couchbase, DynamoDB

Caches -> Client caching, CDN caching, Webserver caching, Database caching, Application caching, Cache @Query level, Cache @Object level

Eviction policies of cache:
&raquo_space; Cache aside
&raquo_space; Write through
&raquo_space; Write behind
&raquo_space; Refresh ahead

Asynchronism -> message queues, Task queues, Back pressure

Communication protocol:
- TCP
- UDP
- REST
- RPC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What should you justify at the end of the system design?

A

(1) Throughput of each layer
(2) Latency caused between each layer
(3) Overall latency justification

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the high level components of the system design that should be included in your interview?

A
  • Storage - Database, database schema, and caching strategy
  • Network traffic (load balancer, routing strategy, distributing requests)
  • Vertical vs Horizontal Scaling strategy
  • Data replication and scaling strategy - sharding
  • Content Delivery Network (CDN)
  • Stateless web tier / stateless architecture
  • Data centers
  • Message queue / producer/consumer service if needed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Latency for L1 cache reference

A

0.5 ms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Latency for branch mispredict

A

5 ns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Latency for L2 cache reference

A

7 ns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Latency for Mutex unlock/lock

A

100 ns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Latency for main memory reference

A

100 ns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Latency for Compress 1K bytes with Zippy

A

10,000 ns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Latency for Sending packet CA to Netherlands to CA

A

150 ms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Latency for send 2k bytes over 1 Gpbs network

A

20,000 ns

17
Q

Latency for Read 1 MB sequentially from memory

A

250,000 ns

18
Q

Latency for Round trip with the same datacenter

A

500,000 ns

19
Q

Latency for disk seek

A

10 ms

20
Q

Latency for read 1MB sequentially from a network

A

10 ms

21
Q

Latency for read 1MB sequentially from disk

A

30 ms

22
Q

What is the 4 step process for effective system design interview performance? What is the time allocation for each?

A

Step 1 - Understand the problem and establish the design scope - 5-10 minutes

Step 2 - Propose high level design and get buy in - 10-15 minutes

Step 3 - Design deep dive - 10-25 minutes

Step 4 - Wrap up - discuss other additional points - 3-5 minutes

23
Q

What are the do’s and don’ts of system design interviews?

A

Do:
- Always ask for clarification and study the problem
- Understand the problem requirements
- Understand there’s no right or wrong answer
- Let the interviewer know what you are thinking
- Suggest multiple approaches if possible
- Go into detail about each component once you have the high level design down
- Bounce ideas of the interview and collaborate with them - treat them as a teammate

Don’ts:
- don’t be unprepared for typical interview questions
- dont’ jump to a solution without clarifying the requirements and assumptions
- don’t be afraid to ask for hints
- don’t think in silence
- don’t think your interview is done once you give the design
-