Opened 7 years ago

Closed 7 years ago

#1395 closed defect (invalid)

Wrong request_time

Reported by:… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.13.x
Keywords: Cc:
uname -a: Linux 3df6a303b918 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.13.0
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1t 3 May 2016
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'


Hello. I logging two parameters - request_time and upstream_response_time, but every time it's equal. For more, request_time in log about 5-7 ms, but browser show about 400-500 ms full load content. Why request_time show wrong time? How detect full time from start respons till last byte, sent to client?
Nginx working in Docker container.

Change History (1)

comment:1 by Maxim Dounin, 7 years ago

Resolution: invalid
Status: newclosed

The $request_time variable shows time of processing a request an nginx side, since it receives first request byte from the client till it finishes sending the response to the socket. Obviously enough, on the client side time will be at least one RTT larger. For large responses the difference will be likely larger, as sending the socket buffer to the client may take noticeable time, and this is not something nginx will see / count, as it it will be done by OS transparently. Depending on what exactly the browser measures, the time it reports may also include DNS resolution time, connection establishment, and SSL handshake.

Summing the above, there are no reasons to say $request_time is wrong as you claim, it is just different from what browser reports. If you want client-side numbers, consider using appropriate timing on the client side instead.

Note: See TracTickets for help on using tickets.