使用 "same" link 的慢 CURL CentOS7

Slow CURL CentOS7 with "same" link

我刚刚安装了带有 nginx (1.8.0) 的 CentOS7 (3.10.0-229.4.2.el7.x86_64)。 这是我的主机文件:

[root@ser_main1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1   arm.site.com kpp.site.com w.site.com server.site.com

还有问题:

[root@ser_main1 ~]# time curl http://arm.site.com/test/fad/site/site?siteId=152
{"OK"}
real    0m0.162s
user    0m0.003s
sys 0m0.003s
[root@ser_main1 ~]# time curl http://127.0.0.1/test/fad/site/site?siteId=152
{"OK"}
real    0m0.011s
user    0m0.002s
sys 0m0.003s

为什么会有这么大的差异? 0m0.162s 和 0m0.011s

这是我的 nsswitch.conf:

passwd:     files sss
shadow:     files sss
group:      files sss

hosts:      files dns myhostname

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files sss

netgroup:   files sss

publickey:  nisplus

automount:  files
aliases:    files nisplus

刚在Fedora Server上测试过,没有这个问题。。。不知道怎么办。。。

strace 显示超时

close(3)                                = 0
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f83f6a0c000
mprotect(0x7f83f6a0c000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f83f720beb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f83f720c9d0, tls=0x7f83f720c700, child_tidptr=0x7f83f720c9d0) = 8463
poll(0, 0, 150)                         = 0 (Timeout)
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3

我发现它是 curl_7.29.0 中的错误。 Here link. And Answer