Baoyuantop commented on issue #12644:
URL: https://github.com/apache/apisix/issues/12644#issuecomment-3350994504

   What you're observing isn't APISIX slowing down or timing anomalies, but 
rather a misunderstanding of different label values within the same latency 
metric family in Prometheus. The latency histogram exposed by APISIX uses the 
first label to distinguish three phases:
   
   1. type=request
   Overall duration: From the request entering APISIX (receiving the client's 
first byte) to the completion of response transmission. Corresponds to Nginx's 
$request_time.
   2. type=upstream
   Upstream interaction time only: From initiating the connection/request to 
the upstream to reading the entire upstream response (or the last upstream 
response if retries occurred).
   3. type=apisix
   APISIX processing time = request − upstream. Includes routing matching, 
plugin chain execution, waits, filtering, LB/retry control, and other stages 
beyond upstream interaction. This is not a separate, additional “fourth time 
period,” but rather the residual time after subtracting upstream time from the 
total time.
   
   Therefore, do not add the three values together. The formula is: request ≈ 
upstream + apisix. If the upstream is not actually accessed (e.g., local direct 
return, authentication failure, rate limiting, early interception), only 
request = apisix will be observed, and upstream will be missing or 0.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to