Hello to all!

From the NGINX documentation "If redundant requests within the burst limit are not required to be delayed, the nodelay parameter should be used". That is, having "nodelay" requests within the burst be processed immediately?

Then is there a difference between:

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; limit_req zone=one burst=5 nodelay; 

AND

 limit_req_zone $binary_remote_addr zone=one:10m rate=6r/s; limit_req zone=one; 

Thank you for your reply!

    1 answer 1

    There is a significant difference.

    The documentation is not written very clearly, but in reality the rate=6r/s means that after a successful request, all others will be rejected for ≈0.16 seconds, i.e. you can not send 6 requests at once and wait a second, you must send them one by one with a break of one sixth of a second.

    burst other burst , allows you to “occupy” a request handler from the future (to process rare bursts). But the average number of processed requests will still not exceed the specified rate .

    In your examples in the first case, you can instantly get answers to 6 requests, but the next successful request will be only a second after the first. In the second case, you can process 6 requests per second, but there should be a 1/6 second break between each request.

    • "all others for ≈0.16 seconds will be rejected" - where does this figure 0.16 come from? Where did you get this more distinct presentation than in the documentation, share links if there are any. - Mihail Politaev
    • @MishaPolitaev The documentation says: Restriction is provided using the leaky bucket method. You can google. And 0.16 is 1/6. - Roman
    • I set up the experiments and looked into the code. - Alexey Ten
    • @AlexeyTen Only in the first example, in theory, the next successful request will be a second after the first , because It is then that the second request frees up space in the "bucket" for one request and you can immediately place the next request there. - Roman
    • @Roman corrected - Alexey Ten