Nginx:需要解释$ request_time

时间:2016-03-31 06:11:59

标签: http nginx apache-httpclient-4.x

我有一个 nginx 的服务器,我正在向客户端发送API响应。

我正在日志中记录$request_time。我需要知道$request_time是否记录了在我的服务器上处理并将请求发送到客户端所花费的时间,或者是否记录了客户端收到响应的时间。

根据天气情况,连接是否保持不变会有什么变化吗?

我阅读的文档说:

According to nginx doc value of $request_time variable (available only at logging) will be compute when all data have been send and connection have been closed (by all upstreams and proxy also). And only then info is appended to log.

但那里没有解释关闭部分的连接。

1 个答案:

答案 0 :(得分:3)

根据the documentation

  

$request_time

     

以毫秒为单位请求处理时间(以秒为单位)   解析度;从第一个字节之间经过的时间是从   客户端和最后一个字节发送到客户端后的日志写入

即。它会在所有数据发送到客户端之前计时,但不包括客户端接收数据所需的时间。

相关问题