educative.io

Educative

Sliding Window with Counters example

Hi,

the example under section #10 Sliding window, "Let’s take an example where we rate-limit at 500 requests per hour with an additional limit of 10 requests per minute. This means that when the sum of the counters with timestamps in the past hour exceeds the request threshold (500), Kristie has exceeded the rate limit. In addition to that, she can’t send more than ten requests per minute. "

I might be wrong but with 10 requests per minute Kristie will have ability to send 600 requests in an hour.
With 500 requests per minute Kristie only had the allowance for 8.3 requests per minute.

Maybe if we increase original rate-limit to be greater than 600, or reduce additional limit.

Let me know if I’m reading this wrong.

Thanks,
Kamran

My understanding is that it’s two conditions with “and” that have to be met: first, it can’t be more than 500 requests in total (summary of all the counters); second, each entry can’t exceed 10.