How to control the total requests in Ngnix

tongshushan at tongshushan at
Sat Dec 2 09:57:02 UTC 2017

I want to set the rate limiting for the entire server not for each client ip.

咪咕视讯科技有限公司 研发部
Email:tongshushan at
From: Gary
Date: 2017-12-01 22:43
To: nginx
Subject: Re: How to control the total requests in Ngnix
Is this limiting for one connection or rate limiting for the entire server? I interpret this as a limit for one connection. 
I got rid of the trailing period.
A request is one line in the access log I assume, typically a html verb like "get".  I use a single core VPS, so I don't have much CPU power. Unless the verb action is trivial, I doubt I would hit 2000/s. From experimentation, a burst of 10 gets the images going mostly unimpeded, and a rate of 10/s is where you see a page just start to slow down. I think a rate of 2000/s isn't much of a limit. 
  Original Message  
From: mdounin at
Sent: December 1, 2017 5:46 AM
To: nginx at
Reply-to: nginx at
Subject: Re: Re: How to control the total requests in Ngnix
On Fri, Dec 01, 2017 at 11:18:06AM +0800, tongshushan at wrote:
> I configured as below:
> limit_req_zone "all" zone=all:100m rate=2000r/s;
> limit_req zone=all burst=100 nodelay;
> but when testing,I use tool to send the request at: Qps:486.1(not reach 2000)  I got the many many 503 error,and the error info as below:
>  2017/12/01 11:08:29 [error] 26592#37196: *15466 limiting requests, excess: 101.000 by zone "all", client:, server: localhost, request: "GET /private/rush2purchase/inventory/aquire?productId=product1 HTTP/1.1", host: "localhost"
> Why excess: 101.000? I set it as 2000r/s ?
You've configured "burst=100", and nginx starts to reject requests 
when the accumulated number of requests (excess) exceeds 
the configured burst size.
In short, the algorithm works as follows: every request increments 
excess by 1, and decrements it according to the rate configured.  If 
the resulting value is greater than burst, the request is 
rejected.   You can read more about the algorithm used in 
Wikipedia, see
Maxim Dounin
nginx mailing list
nginx at
nginx mailing list
nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list