Calculating Server Processing Time With Curl
I'd say that you're right, (time_starttransfer - time_connect) definitely is an amount of time server took to process the request.
However - I also wondered what is the difference between time_connect and time_pretransfer? (intrigued by @Schwartzie and @Cheeso comments)
By looking at several curl queries on the web I observed that sometimes they're equal and sometimes they're not.
Then I figured out (at least I believe so) that they differ only for HTTPS requests, cause server needs some time to decrypt ssl layer, which is not exactly the time spent by the target app but the time spent by server hosting the app/service.
The time to decrypt ssl (and to connect also, the one given in time_connect) is time_appconnect, and only when it's 0 (like for non-https requests) - time_connect and time_pretransfer are EQUAL, otherwise for https requests they differ, and for https time_pretransfer would be equal to time_appconnect (and not to time_connect).
Check the following two examples:
curl -kso /dev/null -w "time_connect=%{time_connect}, time_appconnect:%{time_appconnect}, time_pretransfer=%{time_pretransfer}\n" http://www.csh.rit.edu
- time_connect=0.128, time_appconnect:0.000, time_pretransfer=0.128
curl -kso /dev/null -w "time_connect=%{time_connect}, time_appconnect:%{time_appconnect}, time_pretransfer=%{time_pretransfer}\n" https://www.csh.rit.edu
- time_connect=0.133, time_appconnect:0.577, time_pretransfer=0.577
so I'd say that time_pretransfer is more precise to be used compared to time_connect since it'll respect ssl connections too, and maybe some other things I'm not aware of.
With all the previous being said, I'd say that more precise answer for the question:
- "How can I determine how much time the server took processing the request?"
would probably be:
- time_starttransfer - time_pretransfer
as @Schwartzie already mentioned, I just wanted to understand why.
Yes, (time_starttransfer - time-connect) is the time from the connect was noticed by curl until the first byte arrived. Do note that it also includes the transfer time so for a remote site it will be longer simply because of that.