简体   繁体   中英

NGinX Rate Limiting With No Burst

I am experiencing unusual behavior with rate limiting in NGinX. I have been tasked with supporting 10 requests per second and not to use the burst option. I am using the nodelay option to reject any requests over my set rate.

My config is: .. http { .. limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s; .. server { .. location / { limit_req zone=one nodelay; limit_req_status 503; .. } } } .. http { .. limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s; .. server { .. location / { limit_req zone=one nodelay; limit_req_status 503; .. } } }

The behavior I am seeing is if a request is sent before a response is received from a previous request NGinX will return a 503 error. I see this behavior with as little as 2 requests in a second.

Is there something missing from my configuration which is causing this behavior? Is the burst option needed to service multiple requests at once?

Burst Works like a queue. No delay means the requests will not be delayed for next second. If you are not specifying a queue then you are not allowing any other simultaneous request to come in from that IP. The zone takes effect for per ip as your key is $binary_remote_addr.

You need a burst.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM