curl - 带有 "same"链接的慢 CURL CentOS7

标签 curl dns centos hosts

我刚刚安装了带有 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.Answer

关于curl - 带有 "same"链接的慢 CURL CentOS7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30871542/

相关文章:

php - 将 cURL 命令行翻译成 PHP cURL

php - 迁移到 https 后 curl 返回 301 错误

bash - curl -D- 选项

apache - 不同主机上的子目录

javascript - 有没有办法检查用户是否可以使用 Javascript 解析某个主机名?

php - WP Auto Login From Yii2 using Curl not working on First Load

c# - Azure SDK C# - 获取自定义域验证 ID

java - 在 Linux 上通过 Java 进程加载 C++ 共享库给出错误

centos - 克隆的虚拟机(Vmware 工作站)上没有互联网

php - 将 wordpress 从共享虚拟主机 cpanel 迁移到 VPS 后出现白屏