Rate limiter and request batcher
Comes up in: Coding, Backend design
This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.
What it covers
- token bucket
- sliding window
- batch calls in the same tick (
queueMicrotask) into one request
Words you will know
What you will practise
- implement both
Interview questions this answers
- Implement a token-bucket rate limiter.
- Implement a function that batches calls made in the same tick into one network request.