Hello! On Fri, Dec 01, 2017 at 11:18:06AM +0800, [email protected] 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 [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
