August 2017
Intermediate to advanced
278 pages
8h 53m
English
The soft delay is a nice way to handle rate limiting in a way which is the least disruptive to most users. However, if you're running an API-based service and want to ensure the requesting application is notified of any request which hits the limit, you can add the nodelay parameter to the limit_req directive. Consider this example:
limit_req zone=basiclimit burst=5 nodelay;
Instead of seeing the connections queued, they're immediately returned with a 503 (Service Unavailable) HTTP error. If we rerun the same initial Apache Benchmark call (even with a single connection), we now see this:
Concurrency Level: 1 Time taken for tests: 4.306 seconds Complete requests: 200 Failed requests: 152 (Connect: 0, Receive: 0, Length: 152, ...
Read now
Unlock full access