System Design 1 Flashcards

1
Q

It means increasing the resources of a specific node

A

Vertical Scaling

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

It means increasing the number of nodes

A

Horizontal Scaling

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

It allows a system to distribute the load evenly so that one server doesn’t crash and take down the whole system.

A

Load Balancer

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

They can get very slow as the system grows bigger.

A

Joins in a relational database such as SQL.

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

It means splitting the data across multiple machines while ensuring you have a way of figuring out which data is on which machine.

A

Sharding (Data partitioning)

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

Common ways of partitioning:

A
  • Vertical Partitioning
  • Key-Based (or Hash-Based) Partitioning
  • Directory-Based Partitioning
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Partitioning by feature.

e.g. In a social network you have a table for profiles, one for messages

A

Vertical Partitioning

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

It uses some kind of data (e.g. an ID) for the partition.

A

Key-based Partitioning.

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

A very simple way to do this is to allocate N servers and put the data on mod(key, n)

A

Key-based Partitioning

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

In this scheme you maintain a lookup table for where the data can be found

A

Directory-Based Partitioning

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

Two major drop backs in Directory-Based Partitioning:

A
  1. The lookup table can be a single point of failure.
  2. Constantly accessing this table impacts performance.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

It is a simple key-value pairing and typically sits between your application layer and the data store.

A

Caching.

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

How you cache

A

You might cache a query and its results directly. Or alternatively you can cache the specific object (a rendered version of the website or a list of the most recent blog posts)

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

Most important metrics around networking

A

Bandwidth, throughput, latency

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

How slow operations should be

A

Asynchronous

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

Is the maximum amount of data that can be transferred in a unit of time, it is expressed in bits per second.

A

Bandwidth

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

Is the actual amount of data that is transferred.

A

Throughput

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

It is how long it takes data to go from one end to the other.

A

Latency

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

It is typically used to process large amounts of data.

A

A MapReduce program.

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

What does a MapReduce program require.

A

It requires to write a Map step and Reduce step.

Map takes in some data and emits a <key, value> pair.
Reduce takes a key and a set of associated values and “reduces” them, emitting a new key and value.

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

Considerations when designing a system.

A
  • Failures
  • Availability and Reliability
  • Read-Heavy vs Write-Heavy
  • Security
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Is a function of the percentage of time the system is operating.

A

Availability.

23
Q

Is a function of the probability that the system is operational for a certain unit of time.

A

Reliability.

24
Q

You could consider queuing up the writes-

A

Write-Heavy.

25
Q

Yo might want to cache.

A

Read-Heavy

26
Q

It’s a network of servers located all around the world.

A

CDN (Content Delivery Network)

27
Q

CDN specifications

A

1.They don’t really run any application logic.
2. They work by taking files hosted on your server (origin server) and copy them onto CDN servers.
3. It’s a technique of caching.

28
Q

It’s the set of rules that decide how we send data over the internet. Works with packets.

A

TCP/IP

29
Q

It’s a decentralized service that works to translate a domain (eg. www.leetcode.com) to it’s IP address (192.0.2.132)

A

DNS (Domain Name System)

30
Q

Is an application level protocol built on top of TCP that follows the client-server model.

A

HTTP

31
Q

How does HTTP work?

A

A client initiate a request, which include two parts: request header and request body. Then the client will receive a response.

32
Q

Information in the Request Header

A

Where the package is going, who it’s from and other metadata.

33
Q

Request Body:

A

It’s the package content.

34
Q

Is a standardization around HTTP APIs making them stateless and following consistent guidelines.

A

REST

35
Q

What is GraphQL?

A

API pattern. Instead of making another request for every single resource in your server, you make a single request and choose which resources to fetch, you can fetch multiple resources with a single request.

36
Q

What is gRPC?

A

Framework, considered an improvement of JSON. Is mainly used for server-to-server communication. Data is serialized into a binary format, although, JSON is more human readable.

37
Q

App layer protocol that supports bidirectional communication:

A

WebSockets

38
Q

Relational Databases. Provides efficient storage and fast power retrieval.

A

SQL

39
Q

ACID.

A
  • Atomicity
  • Consistency
  • Isolation
  • Durability
40
Q

Every transaction is fully performed or not performed at all.

A

Atomicity.

41
Q

Means that foreign keys and other constraints are enforced.

A

Consistency (Database).

42
Q

Means that different concurrent transactions won’t interfere with each other.

A

Isolation.

43
Q

Even if a machine dies data will still be there.

A

Durability.

44
Q

No-SQL databases examples.

A

Key-value stores, document stores and Graph DBs.

45
Q

Refers to the process of creating and maintaining multiple copies of data or system components.

A

Replication

46
Q

This states that it is not possible for a distributed computer system to simultaneously provide all three of guarantees.

A

CAP (Consistency, Availability and Partition) Theorem.

47
Q

All nodes see the same data even at the same time with concurrent updates

A

Consistency.

48
Q

A guarantee that every request receives a response about whether it was successful or failed.

A

Availability

49
Q

The system continues to operate despite arbitrary message loss or failure of part of the system.

A

Partition Tolerance.

50
Q

Is an XML based industry standard protocol for designing and developing web services.

A

SOAP (Simple Object Access Protocol)

51
Q

Is a software design approach that organizes applications as a collection of services.

A

SOA (Service Oriented Architecture)

52
Q

How does SOA work?

A

The services communicate with each other through well-defined interfaces, often using standard protocols like SOAP or REST.

53
Q

Key Characteristics of SOA.

A
  • Loose Coupling
  • Reusability
  • Modularity
  • Interoperability
54
Q

Desine Loose Coupling

A

Services are independent and can be modified without affecting other services.