Grokking Java Interview Questions
0% completed
Implement a Rate Limiter
The price service of a grocery store allows each customer 5 requests per 1,000 milliseconds. Its first limiter counted the requests of each second, and its counter returned to 0 at the start of the next second. A test then sent 12 requests within 290 milliseconds, and 10 of them were allowed.
A rate limiter decides for each request whether to allow or reject it, so that one caller cannot use too much of a service. Three designs follow: a counter, a log of times, and a bucket of tokens. The last design then serves several customers and several threads.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%