-1

I asked this on networkengineering.se, and they suggested I move it here.


I tried to test the speed of my website, so I used

time curl "http://google.com"

The result ended with

real 0m15.589s user 0m0.012s sys 0m0.000s

I tried to see what took so long, so I timed hosts time host google.com

and got

real 0m0.180s user 0m0.008s sys 0m0.004s

And time curl "http://216.58.217.206"

and got

real 0m0.163s user 0m0.000s sys 0m0.004s

0.18 s + 0.16 s (time to lookup DNS and downloading data) is much less than 15.58s!!

Why does curl take so long?


I ran these commands these a few times in a row, so caching isn't the issue

goog
  • 19
  • 2

1 Answers1

0

You could run curl -v "http://google.com" for a more verbose output that might allow you to see where the delay occurs. 15 seconds is long enough for there to be a visible wait at some point.

Mintra
  • 561
  • 3
  • 7
  • It's between "Rebuilt URL to: http://google.com/" and "Trying 216.58.219.14..." – goog Dec 22 '15 at 00:04
  • I don't see a "Rebuilt URL..." line at all when I try, and am not actually sure what that means; can't find it in the docs anywhere. What version of curl is that (`curl -V`)? – Mintra Dec 22 '15 at 09:45
  • curl 7.45.0 (x86_64-pc-linux-gnu) libcurl/7.45.0 GnuTLS/3.3.18 zlib/1.2.8 libidn/1.32 libssh2/1.5.0 nghttp2/1.5.0 librtmp/2.3 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets – goog Dec 24 '15 at 06:55