# Rate limiting intervals

**URL:** <https://www.ruby-forum.com/t/rate-limiting-intervals/238581>\
**Category:** NGINX\
**Created:** [January 17, 2014, 10:53pm UTC](https://www.ruby-forum.com/t/rate-limiting-intervals/238581 "2014-01-17T22:53:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [January 17, 2014, 10:53pm UTC](https://www.ruby-forum.com/t/rate-limiting-intervals/238581/1 "2014-01-17T22:53:15Z")

</div>

Hello,

With the rate limiting module you can easily rate limit based on seconds  
or  
on minutes.  
What I would like to do however is rate limit based on a 100 millisecond  
or  
10 millisecond interval.

That way you do not have a burst of requests at the beginning of a  
second.  
But a more continuous flow of requests.

Is this possible with nginx?  
If not can anyone point me to the right location in the source where the  
rate limiting is actually done.

(I assume it has something to do with ngx\_http\_limit\_req\_lookup in  
ngx\_http\_limit\_req\_module.c)

Thanks in advance,  
Pieter

Posted at Nginx Forum:

> **[Rate limiting intervals](https://forum.nginx.org/read.php?2,246575,246575#msg-246575)**
>
> Hello, With the rate limiting module you can easily rate limit based on seconds or on minutes. What I would like to do however is rate limit based on a 100 millisecond or 10 millisecond interval. That way you do not have a burst of requests at the...

---

<div class="post-metadata">

**Author:** ![PieterVI](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c67d28/32.png) [@PieterVI](https://www.ruby-forum.com/u/PieterVI)\
**Post date:** [January 17, 2014, 11:28pm UTC](https://www.ruby-forum.com/t/rate-limiting-intervals/238581/2 "2014-01-17T23:28:51Z")

</div>

On Friday 17 January 2014 16:52:31 PieterVI wrote:

> Hello,
> 
> With the rate limiting module you can easily rate limit based on seconds or  
> on minutes.  
> What I would like to do however is rate limit based on a 100 millisecond or  
> 10 millisecond interval.  
> […]

100r/s is an equivalent of 1 request per 10 milliseconds.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![PieterVI](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c67d28/32.png) [@PieterVI](https://www.ruby-forum.com/u/PieterVI)\
**Post date:** [January 18, 2014, 1:01am UTC](https://www.ruby-forum.com/t/rate-limiting-intervals/238581/3 "2014-01-18T01:01:02Z")

</div>

On Friday 17 January 2014 18:26:09 PieterVI wrote:

> Hi Valentin,
> 
> I know that 100r/s is equal to 1 request per 10 milliseconds.
> 
> If you specifiy 100r/s nginx will send 100 requests within the first  
> milliseconds of a certain second.  
> […]

Yes, but only if you have set burst=100.

There is no second/minute granularity in limit\_req module. It’s just a  
measure.

If you set 100r/s with zero burst, then every request received in less  
than 10 milliseconds after the previous permitted one will be declined.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![PieterVI](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c67d28/32.png) [@PieterVI](https://www.ruby-forum.com/u/PieterVI)\
**Post date:** [January 18, 2014, 8:18pm UTC](https://www.ruby-forum.com/t/rate-limiting-intervals/238581/4 "2014-01-18T20:18:10Z")

</div>

Hi Valentin,

Thanks for the info. That indeed does seem to work as you mention.  
I have to figure out what else is going wrong then.

Thanks,  
Pieter

Posted at Nginx Forum:

> **[Re: Rate limiting intervals](https://forum.nginx.org/read.php?2,246575,246583#msg-246583)**
>
> Hello, With the rate limiting module you can easily rate limit based on seconds or on minutes. What I would like to do however is rate limit based on a 100 millisecond or 10 millisecond interval. That way you do not have a burst of requests at the...

---

<div class="post-metadata">

**Author:** ![PieterVI](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c67d28/32.png) [@PieterVI](https://www.ruby-forum.com/u/PieterVI)\
**Post date:** [January 18, 2014, 12:26am UTC](https://www.ruby-forum.com/t/rate-limiting-intervals/238581/5 "2014-01-18T00:26:50Z")

</div>

Hi Valentin,

I know that 100r/s is equal to 1 request per 10 milliseconds.

If you specifiy 100r/s nginx will send 100 requests within the first  
milliseconds of a certain second.  
Once these request are done no request will be handled anymore.

When you would be able to specifiy more granular rate limiting interval  
you  
whould be able to get a more continuous load.  
see: [Startseite - imagebin.org](http://imagebin.org/287286)

Kind regards,  
Pieter

Posted at Nginx Forum:

> **[Re: Rate limiting intervals](https://forum.nginx.org/read.php?2,246575,246578#msg-246578)**
>
> Hello, With the rate limiting module you can easily rate limit based on seconds or on minutes. What I would like to do however is rate limit based on a 100 millisecond or 10 millisecond interval. That way you do not have a burst of requests at the...
