Slow CURL CentOS7 with "same" link

495 views Asked by At

I just installed CentOS7 (3.10.0-229.4.2.el7.x86_64) with nginx (1.8.0). Here my hosts file:

[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

And problem:

[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

Why can be such big difference? 0m0.162s and 0m0.011s

Here my 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

Just tested it on Fedora Server, and there is no such problems... I dont know what to do...

1

There are 1 answers

0
Hulii Borys On BEST ANSWER

strace show some timeout

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

And i found that it is bug in curl_7.29.0 . Here link. And Answer