Design A Rate Limiter Flashcards

1
Q

Examples of rate limiter usage?

A
  • user can write no more than 2 posts per second
  • you can create max of 10 accounts per day from the same IP address
  • you can claim rewards no more than 5 times per week from the same device
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the benefits of using rate limiters?

A

DCO
- D: DoS by blocking excess calls
- C: Reduce costs
- O: Prevent servers from being overloaded

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

What is the API Gateway?

A

It’s a fully managed service that supports rate limiting, SSL termination, authentication, IP whitelisting,
servicing static content, etc.

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

What are the popular rate limiter algorithms?

A
  • token bucket
  • leaking bucket
  • fixed window counter
  • sliding window log
  • sliding window counter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Token bucket? Pros and cons?

A

+
easy to implement
memory efficient
allow burst of traffic
-
might be challenging to tune

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

Leaking bucket? Pros and cons?

A

+
memory efficient
fixed rate and stable outflow
-
burst of traffic doesn’t work here
might be challenging to tune

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

Fixed window counter? Pros and cons?

A

+
memory efficient
easy to understand
-
spike in traffic at the edges of a window

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

Sliding window log? Pros and cons?

A

+
is very accurate
-
consumes a lot of memory

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

HTTP code for to many requests?

A

429

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

Lua script?

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