My problem is that I cannot figure out why I'm getting such slow response times using curl and wget. When I say slow, I mean a minimum of five or six seconds for a page which should take only a second or less.
I've tested all kinds of scenarios, but I can't seem to make any difference at all.
My server is: CentOS Linux release 7.3.1611 (Core)
I'm trying to fix this because it is slowing down a newly installed WordPress application. I ended up identifying (using Xdebug) that, rather than the problem being WP, it appears to be PHP calls which use curl. Subsequently I've been testing from the command line, without any other application.
So, for example:
$ curl -o /dev/null "http://techrepublic.com"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 30 0 0:00:05 0:00:05 --:--:-- 41
It doesn't make any difference what the URL is, but if I use an IP address, instead of a domain name, then there's no problem at all.
The same problem is also true using wget.
So, some of the things I've tried are:
My primary DNS server is now listed in /etc/resolv.conf as 8.8.8.8, which should be fine.
To get more information, I also used this:
$ 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' 'techrepublic.com'
Output:
lookup: 5.514
connect:5.528
appconnect:0.000
pretransfer:5.528
redirect:5.819
starttransfer: 6.680
total:12.552
(not sure why, but using curl this way seems to take longer than using it without all the options, but either way it's still taking far too long)
So, I'm figuring that somehow, somewhere, this is related to DNS lookups, but I'm really not sure what else to try. It's very frustrating.
Any assistance would be greatly appreciated. Thanks!
Хорошо, проблема решена. После того, как снова в поисках аналогичных проблем в Интернете я наткнулся на этот сайт, на котором описывалась та же проблема:
http://aarvik.dk/disable-ipv6/
Добавление следующей строки в конец / etc / resolv.conf решил проблему для меня, но я рекомендую вам прочитать статью полностью:
options single-request-reopen