[英]NGinX Rate Limiting With No Burst
I am experiencing unusual behavior with rate limiting in NGinX. 我在NGinX中遇到速率限制的异常行为。 I have been tasked with supporting 10 requests per second and not to use the burst option.
我的任务是每秒支持10个请求,并且不使用burst选项。 I am using the nodelay option to reject any requests over my set rate.
我正在使用nodelay选项拒绝超过设定速率的任何请求。
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; .. } } }
.. 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. 我看到的行为是,如果在从先前请求收到响应之前发送了请求,则NGinX将返回503错误。 I see this behavior with as little as 2 requests in a second.
我看到这种行为在一秒钟内只有2个请求。
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.
如果您未指定队列,那么您将不允许该IP发出任何其他同时请求。 The zone takes effect for per ip as your key is $binary_remote_addr.
该区域对每个IP生效,因为您的密钥是$ binary_remote_addr。
You need a burst. 您需要突击。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.