
贴一部分 nginx 的 access.log 的数据, 分别是
method, request_time, upstream_response_time, request_time - upstream_response_time
"GET 0.143 1.131 0.988 "GET 0.053 0.053 0 "POST 0.029 0.029 0 "GET 0.037 3.034 2.997 "GET 0.138 0.690 0.552 "POST 0.072 0.072 0 "GET 0.063 3.833 3.77 "GET 0.056 1.055 0.999 "POST 0.029 3.471 3.442 "GET 0.347 0.378 0.031 "GET 0.074 3.899 3.825 "GET 0.077 0.077 0 "GET 0.018 0.018 0 "GET 0.030 0.030 0 "GET 0.034 0.034 0 "GET 0.063 0.063 0 "POST 0.031 0.035 0.004 "POST 0.031 0.031 0 "POST 0.030 0.030 0 "GET 0.077 3.552 3.475 "GET 0.137 0.140 0.003 "POST 0.030 0.033 0.003 "GET 0.285 1.557 1.272 "GET 0.056 0.056 0 "GET 0.076 3.960 3.884 "GET 0.076 3.453 3.377 "POST 0.124 0.186 0.062 "HEAD - 0.000 0 "GET 0.007 1.006 0.999 "POST 0.031 0.925 0.894 "POST 0.032 0.032 0 "GET 0.048 0.675 0.627 "POST 0.030 0.030 0 想了解一下在 cpu, 内存都没满的情况下, 为什么 request_time 和 upstream_response_time 在部分请求中相差这么大.
以我现在的了解, request_time 是外网请求进出 nginx 的时间
而 upstream_response_time 是 nginx 将请求交给后端服务器处理到返回的时间
1 eric6356 2016-05-18 22:42:29 +08:00 因为 client 和 server 之间的网络情况各不相同吧? |
2 ryd994 2016-05-18 23:32:00 +08:00 是不是两个时间反了? request_time>upstream_response_time 才对 因为 nginx 有 buffer ,在返回数据量不大的情况下,数据全部进 buffer ,关闭上游连接,然后慢慢发给 client |
3 happywowwow OP @ryd994 没有反啊 第四列数据都是大于等于 0 的 |
4 happywowwow OP @eric6356 诶? 什么意思 |
5 eric6356 2016-05-18 23:41:04 +08:00 @happywowwow request_time 是 nginx 接到 request 的时间,然后 nginx 会等 client 把全部的数据发过来存 buffer ,再交给 upstream 。 client 和 server 之间的网络情况各不相同,这会导致这个时间差各不相同。 |
6 happywowwow OP @eric6356 部分请求需要 秒 级别的返回 这算是正常么 |
7 eric6356 2016-05-18 23:43:47 +08:00 @happywowwow 具体讲的可能有点不对,但大致是这个意思 |
8 ryd994 2016-05-18 23:46:08 +08:00 @happywowwow 第一行 0.143 1.131 你说哪个大? |
9 eric6356 2016-05-18 23:48:38 +08:00 @happywowwow 我认为很正常,国内的网络,某些时候跨运营商跳来跳去能访问到已经很不容易了。 |
10 happywowwow OP @ryd994 啊.. 才发现 写反了.. method, upstream_response_time, request_time, request_time - upstream_response_time |