Centos – Slow curl from php, other

centoscurlnetworkingPHP

Recently switched to a different server, some php files use curl and seemed to be running fine originally but not so much anymore. Here is curl_getinfo for google.com

array(20) { 
    ["url"]=> string(22) "http://www.google.com/" 
    ["content_type"]=>  string(24) "text/html; charset=UTF-8" 
    ["http_code"]=>  int(200) 
    ["header_size"]=>  int(504) 
    ["request_size"]=>  int(1136) 
    ["filetime"]=>  int(-1) 
    ["ssl_verify_result"]=>  int(0) 
    ["redirect_count"]=>  int(1)
    ["total_time"]=>  float(20.098232) 
    ["namelookup_time"]=>  float(0.006034) 
    ["connect_time"]=>  float(0.020963) 
    ["pretransfer_time"]=>  float(0.020999) 
    ["size_upload"]=>  float(0) 
    ["size_download"]=>  float(5481) 
    ["speed_download"]=>  float(272) 
    ["speed_upload"]=>  float(0) 
    ["download_content_length"]=>  float(5481) 
    ["upload_content_length"]=>  float(0) 
    ["starttransfer_time"]=>  float(0.047948) 
    ["redirect_time"]=>  float(20.035229) 
}

There is 1 redirect and it is somehow taking 20 seconds, basically 100% of the time I wait.

There are other odd delays as well, logging into ssh is taking 20-30 seconds to authenticate/deny after password and that used to be instant.

Any ideas?

Best Answer

The problem was IPv6 - for some reason the DNS was taking 20 seconds to fall back to IPv4. Removing IPv6 support solved the problem.

Related Topic