How to control the total requests in Ngnix
Gary
lists at lazygranch.com
Fri Dec 1 14:43:36 UTC 2017
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.
https://en.wikipedia.org/wiki/Leaky_bucket
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 mdounin.ru
Sent: December 1, 2017 5:46 AM
To: nginx at nginx.org
Reply-to: nginx at nginx.org
Subject: Re: Re: How to control the total requests in Ngnix
Hello!
On Fri, Dec 01, 2017 at 11:18:06AM +0800, tongshushan at migu.cn 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: 127.0.0.1, 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 https://en.wikipedia.org/wiki/Leaky_bucket.
--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list