Chapter 1: Basics of System Design Flashcards

1
Q

How to give a SD interview

A
  1. Comprehend scope of the question.
  2. Never assume things that are not explicitly stated
  3. Gather all the requirements
  4. You are required to scale breadth and depth of a blurred problem.
  5. The solution is not the goal of the interview, it is the conversation, which should cover breadth as well as depth.
  6. Break problem into modules and tackle modules individually.
  7. There are no solutions to many system design problems, its about making progress.
  8. Summary
    a. Scoping the problem.
    b. Sketching up and abstract design
    c. Identify and address bottlenecks.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

System Design basics

A
  1. What are different architectural pieces that can be used
  2. How do these pieces work with each other?
  3. How can we best utilize these pieces and what are the tradeoffs?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Load balancing

A

Can be added at three layers

  1. Between user and webserver
  2. Between webserver and appserver
  3. Between appserver and database.
  4. Smart client
  5. Hardware load balancer.
  6. Software load balancer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Caching

A
  1. Appserver cache
  2. Distributed cache (consistent hashing)
  3. Global cache
  4. Content distribution network
  5. Cache invalidation
    a. Write through
    b. Write around
    c. Write back
  6. Eviction policies
    a. FIFO
    b. LIFO
    c. LRU
    d. LFU
    e. Random
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Sharding or Data Partitioning

A

Methods:
1. Horizontal - different rows on different machines. Also called range based partitioning. Unbalanced - side effect.
2. Vertical partitioning
3. Directory based partitioning - There will be a directory server which will handle redirecting queries to the server.
Criteria:
1. Key or hash based partitioning.
2. List partitioning - based on group like region
3. Round robin.
4. Composite of above

Common problems of sharding

  1. Joins and Denormalization
  2. Referential integrity.
  3. Rebalancing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Indexes

A

Nothing much

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

Proxy

A

Proxy sits between user and app server and can cache data.

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

Queues

A

For large scale processing

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

Redundancy and Replication

A

Shared nothing architecture

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

SQL vs NoSQL

A

SQL:
Relational databases, mysql, oracle etc.
NoSQL:
Key - Value stores, document databases, Wide-Column databases, graph databases

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

CAP Theorem

A

Consistency, Availability and partition all three cannot be achieved.

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

Consistent Hashing

A

Having n hash servers and dividing data with hash % n will not scale. Some servers become hot and others cold depending on data.

ConsistentHashing:
/Users/manish/Downloads/687474703a2f2f626c6f672e636f64696e676c6162732e6f72672f75706c6f6164732f70696374757265732f636f6e73697374656e742d68617368696e672f362e706e67.png

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

Long-Polling Vs WebSockets vs Server sent events

A
  1. Ajax
  2. Long polling:
    Server may not immediately respond.
    Client may immediately re request, so that server will be able to push as soon as it has data. This is sometimes called hanging get.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Websockets

A

Provides full duplex communication over TCP.

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

Server side events

A

Only server to client communication.

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

A step by step guide to system design interview

A
  1. Requirements clarification.
  2. Interface definition
  3. Back of envolope estimation
  4. Defining data model
  5. High level design
  6. Detailed design