How soon does nginx's token bucket replenish when limiting at requests per minute?

Posted by Michael Gorsuch on Server Fault See other posts from Server Fault or by Michael Gorsuch
Published on 2010-05-28T17:45:11Z Indexed on 2010/05/28 17:53 UTC
Read the original article Hit count: 307

Filed under:
|
|

Hi all. We've decided that we want to experiment and limit requests per minute instead of requests per second on our sites. However, I am confused by the burst parameter in this context.

I am under the impression that when you use the 'nodelay' flag, the rate limiting facility acts like a token bucket instead of a leaky bucket. That being the case, the bucket size is equal to the burst parameter, and every time that you violate the policy (say 1 req/s), you have to put a token in the bucket. Once the bucket is full (being equal to the burst setting), you are given a 503 error page.

I am also under the impression that once a violator stops going against the policy, a token is removed from the bucket at a rate of 1 token/s allowing him to regain access to the site.

Assuming that I have the above correct, my question is what happens when I start regulating access per minute? If we chose 60 requests per minute, at what rate does the token bucket replenish?

© Server Fault or respective owner

Related posts about nginx

Related posts about rate-limiting