cURL Basic Tutorial for HTTP Timing Measurement

Panos Vouzis
1 min readJan 11, 2016

--

When it comes to HTTP transactions, cURL is a very useful utility with a wide range of capabilities. Apart from returning the response of the actual HTTP requests, it also provides a busload of additional information and metrics about the transactions themselves. For example, it can return error codes and/or information about the timing of the transaction. And the output can be completely customized to provide only the information required and in the desired format.

As an example, you can use cURL to test both the return value of an API call as well its performance. To give you an idea of the type of output you can get, cURL breaks down a call to https://google.com in terms of timing here:

$ curl -L — output /dev/null — silent — show-error — write-out ‘lookup: %{time_namelookup}\nconnect: %{time_connect}\nappconnect: %{time_appconnect}\npretransfer: %{time_pretransfer}\nredirect: %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal: %{time_total}\n’ ‘https://google.com'

lookup: 0.060
connect: 0.076
appconnect: 0.114
pretransfer: 0.114
redirect: 0.181
starttransfer: 0.275
total: 0.511

Go ahead and paste this into your console to see what timing information you get on your machine and network. Do it a few times under different conditions on your network (e.g. while uploading a video on Dropbox) to see if these numbers change significantly or not.

To find out how to put together a cURL command that gives you the information in the format you can read my longer post here: HTTP transaction timing breakdown with cURL.

--

--