4.1 - Scaling (TT1 CUTOFF) Flashcards

(17 cards)

1
Q

What are the 3 ways to handle more traffic?

A
  1. More servers (costly, pay per second)
  2. Better code (pay people to write code, takes time)
  3. Do less work with caching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do we get the client to do less work if it’s pushed onto them?

A

Maybe some things frequently requested can be locally cached to avoid expensive DB requests

e.g: YouTube video is super compressed from DB, client uses video card to render it

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

What’s a CDN?

A

Content Distribution Network:
- fancy cache

  • Now we don’t host the video, some other network of servers cache it closer to the user location to reduce latency
  • main goal is to store big stuff
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does a reflection attack work?

A
  1. One attacker sends a small request to some service
  2. That service acks the request, but sends it to a different server (the one to attack) and it’s a huge output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If an error in the database occurs, how does the web server handle it when the browser is sending requests?

A

It failed, but doesn’t have to stop

  • host whatever it can in absence of DB?
  • send good, useful error messages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you recover from an error?

A
  • reconnect while loop
  • report errors with a log, alert system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In the simplest form, what is cache?

A

key-value pairs

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

What HTTP methods could be cached?

A

Safe methods where it won’t change, like GETs

  • Definitely not POST, meant to CHANGE things on serverside
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s good to cache?

A

Resource intensive things that aren’t updated very frequently

suggestions from amazon/netflix, maybe updates 1x/week

trending things (precomputed cache based on user id)

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

What’s memcache?

A

Cache in memory (high performance)

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

With 2 web servers, if the database is down, why could it be a bad idea to get the info there?

A

We shouldn’t assume cache is valid when the database is down, could be out of data and now we need to sync them, don’t want to screw it up more

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

What to do when a the database is down?

A
  • send a good error message
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What’s the best request for a DOS?

A

Something that’s a small request size, but large response size (for A1 this would be GET)

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

What parts of a system can be DOS’d?

A

CPU time
Network (bandwidth, connections)
Memory

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

How do we address CPU to prevent DOS’s?

A
  • write better code
  • add more machines (horizontal scaling) or better machines
  • break up the problem, add a new layer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do we address Connections to prevent DOS’s?

A
  • fix port saturation by:
  • shorter timeouts (kick people out)
  • horizontal scaling (more machines,threads)
17
Q

How do we address Memory to prevent DOS’s?

A
  • really depends