System Design Flashcards

(52 cards)

1
Q

TCP v. UDP

A

TCP
Transport layer – accuracy > speed
Connection-oriented – client and server must be connected before data sent
stateful protocol – can detect errors

UDP
speed > accuracy
real time service but some delays

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

HTTP and HTTPS

A

defines method requests, addresses, default ports
works on top of Transport Layer Security

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

TLS Handshake

A

client sends a request
servers submits a digital certificate
if certificate accepted by the client, client generates a session key to encrypt info transmitted during the session
handshake finishes, session begins

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

websocket

A

unprovoked server send!
server send data to clients without receiving a request first
Messages to be passed back and forth

use case: real-time data. up-to-date info is critical

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

transport layer

A

tcp – accuracy > speed
udp – speed > accuracy (video streaming)

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

retries

A

fail fast - low limit and alert user
risk thundering herd
jitter to introduce randomness in reqs

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

circuit breakers

A

opens when problem is detected
prevent cascading failures when shared resource goes down

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

rate limiting

A

cap usage, prevent autoscaling > budget. control reqs by customer
token bucket
leaky bucket
fixed and sliding window

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

queue based load leveling

A

order tasks in queue when they are concurrently requesting a service
introduces latency
good for scenarios when latency is ok and order matters

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

gateway aggregation

A

put a gateway in front of backend to aggregate and then dispatch requests.
Risk point of failure.

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

load balancing methods

A

round robin, least connections, consistent hashing

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

load balancing industry standard

A

nginx, amazon elb

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

load balancing pros

A

reliability, scalability, performance

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

load balancing risks

A

bottleneck
need to share session data across backends
longer deploys

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

scalable systems features

A

reliability (retries)
availability (rate limiting)
load balancing

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

sql db pros

A

relational - foreign keys
SQL querying language
structured data
ACID compliant - all or nothing transactions

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

sql db cons

A

hard to scale write-heavy systems
more work to define schema
harder to store unstructured data

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

nosql db pros

A

good for unstructured data
key-value pairs stored in docs
good for scaling -> support heavy write and read systems

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

nosql db cons

A

eventual consistency
harder to query multiple tables

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

types of db sharding

A

geo sharding
range sharding (first letter)
hash sharding

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

sharding pros

A

more scalable
faster queries with indexing
one shard downtime won’t affect all
reduce hardware costs

22
Q

sharding cons

A

not all data can be sharded
foreign key reltns only maintained within a single shard
table joins very expensive

23
Q

analytics

A

batch processing

24
Q

web crawling

A

batch processing

25
large file uploads
job queue
26
real-time events
stream processing - fast yet brittle
27
generating a newsfeed
pub sub
28
scheduled tasks
job queue, batch processing
29
in-memory application caching
server maintains the cache more memory demands
30
distributed in-memory caching
redis, memcache 3rd party server
31
database cache
use db to cache
32
file-system cache
cdn -- store commonly accessed files
33
caching policies
FIFO LRU LFU TTL
34
write through cache
updates cache and mem simultaneously. consistency > speed
35
write-behind cache
updates mem and cache asynch speed> consistency
36
Symmetric Encryption
Faster, less compute, less secure Same key for encryption and decryption. Used for communication post TLS handshake.
37
Assymetric Encryption
Slower, more compute, more secure. Used to establish TLS handshake. RSA TLS
38
In transit encryption
HTTPS, TLS
39
at rest encryption
Encrypt dbs and hash and salt passwords
40
messaging encryption
end-to-end encryption. Only stored on users' device
41
Authentication
username and pw login 1FA, MFA Session or Token
42
Session Authentication
server creates session id stores in cookie in users' browser stateful -- more complex
43
Token Authentication
Server creates an encrypted token at login and client stores token in memory stateless - token stored in db
44
JWT
small, secure, easy to parse, transparent (easy to tell if they've been tampered w)
45
Types of Authorization
RBAC, ABAC - company wide ACL - granular
46
Cloud architecture pros
Upfront affordability Pro maintenance Scalability Security
47
Cloud architecture cons
Higher cost of ownership Loss of control vendor lock Industry specific regulations Location specific No airgapping
48
Cloud Provider Offerings
VMs, GPUs, batch processing Containers Dbs Networking
49
Terraform
Infrastructure as code Declare VMs, DNS records, low-layer resources in code
50
Kubernetes
Declare upper-layer resources in code Group containers in clusters to manage and allocate resources
51
Push CDN
engineer pushes CDN w every update
52
Pull CDN
ass