If requests are delayed by nginx rate limiting (rate limit exceeded, but within burst rate), is this delay included in the nginx $request_time
total?
The nginx docs state that $request_time
is "time elapsed since the first bytes were read from the client"
If a request is delayed, is that before or after request bytes are read from the client? I assume after, since rate limiting can be based on request headers, etc.
Is there a way to separate total request time and time spent specifically on sending/receiving network communication to/from the client?
Note: I am aware of $upstream_response_time
, and am logging that. I specifically am concerned with differentiating specific operations within nginx (caching, rate limiting, etc), and client-side network communications.
So, in my testing, nginx
$request_time
logging does reflect delay due to rate limiting.Client:
Config:
nodelay
removed from static rate limiting, and rate limit to1r/s
, burst set to80r/s
.Test Results:
Nginx logs showed requests being delayed:
Access logging was configured as:
and access logs showed climbing
$request_time
values (3rd value from end), as requests were increasingly delayed to fall into the configured limit: