wiki'd

by JoKeru

Measure web server response time with cURL

cURL is mostly used to retrieve web content, but it also can provide feedback for a sysadmin / network admin / webmaster.

Let's take an example:

$ cat <<'EOF' > curl-info
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
size_download: %{size_download} Bytes\n
----------\n
time_total: %{time_total}\n
EOF

$ curl -s -w'@curl-info' wiki.jokeru.ro -o /dev/null
time_namelookup: 0.173
time_connect: 0.338
time_appconnect: 0.000
time_pretransfer: 0.338
time_redirect: 0.000
time_starttransfer: 1.077
size_download: 125156 Bytes
----------
time_total: 2.495

The output is very simple to understand:

  • name resolution for wiki.jokeru.ro took 0.173 seconds
  • a tcp connection with the remote server (wiki.jokeru.ro on port 80) was established after 0.165 seconds (0.338 - 0.173)
  • 0.739 seconds (1.077 - 0.338) is the delay between the first byte that is about to be transferred from the server and the moment when the connection was established and the request was sent (this is mostly the web server processing time: reading files, mysql queries, computing stuff ... whatever)
  • we also see a problem with the connection speed: 125156 Bytes received in 1.418 seconds (2.495 - 1.077), that is 706 kbps

Comments