bzp2010 commented on issue #12644: URL: https://github.com/apache/apisix/issues/12644#issuecomment-3384800106
The starting of request timing is when Nginx completes the TCP handshake with the client and begins accepting packets, not when it actually enters APISIX to execute logic. Nginx will only begin executing APISIX logic after receiving the complete request headers. https://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_time > $request_time > request processing time in seconds with a milliseconds resolution (1.3.9, 1.2.6); time elapsed since the first bytes were read from the client The current algorithm's calculation isn't entirely rigorous. APISIX's processing time is simply assumed to be the total request time (obtained from Nginx variables) minus the upstream processing time. This scenario only holds when downstream (client-side) processing time is negligible. Therefore, if the client has a slow internet connection, these data transfer times will be included in the APISIX timing. --- APISIX's latency should ideally be measured by the APISIX itself rather than calculated through simple subtraction using the aforementioned algorithm, as this approach yields more accurate results. However, the legacy code was implemented that way. If you're interested in this, feel free to submit a pull request for it. -- 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]
