I had some failing API calls in a mobile client. In order to investigate, I followed Joseph Scott's advice and executed curl with a few debugging parameters:
The results from the Amazon EC2 server:
time_namelookup: 0.011 time_connect: 0.011 time_appconnect: 0.016 time_pretransfer: 0.027 time_redirect: 0.000 time_starttransfer: 0.049 ---------- time_total: 0.049
The results from a laptop (in Israel):
time_namelookup: 5.004 time_connect: 5.264 time_appconnect: 5.851 time_pretransfer: 5.851 time_redirect: 0.000 time_starttransfer: 6.188 ---------- time_total: 6.188
# # Mac OS X Notice # # This file is not used by the host name and address resolution # or the DNS query routing mechanisms used by most processes on # this Mac OS X system. # # This file is automatically generated. # nameserver 192.168.0.1
- The TTL is 300.
- The high time_namelookup does not change after a few consecutive calls, so it's not a local cache issue.
- The problem happens both with CNAME and A records.
Any idea why the time_namelookup takes so long?
When I execute the same command in a different wireless network, I get the following:
time_namelookup: 0.003 time_connect: 0.273 time_appconnect: 2.189 time_pretransfer: 2.189 time_redirect: 0.000 time_starttransfer: 3.200 ---------- time_total: 3.201
This probably means that the long
time_namelookup was indeed a firewall issue. Thanks to everybody who helped!