WGET 从 https 下载非常慢

WGET 从 https 下载非常慢

如果使用 https 协议,wget 会出现性能问题。在多台服务器上,大多数服务器运行良好,但其中一台服务器的速度慢了 10 倍,并且在此期间 CPU 负载很高:

wget -d --inet4-only --no-check-certificate -O /dev/null https://127.0.0.1

--> 20...60 秒

  • 如果我在慢速服务器上使用相同的命令,但只有 http:// --> 1s

  • 如果我使用相同的命令从另一台服务器通过 https:// 连接到慢速服务器 --> 1..2s

  • IPv6 尚未启用,因此即使使用 --inet4-only 来自 https:// --> 20..60s

  • 由于即使有 IP 地址,问题也会被解决,因此不涉及 DNS 解析

  • 网络服务器不可能是问题所在,因为从另一台服务器到慢速服务器的 wget 速度很快

  • 自签名证书不会有问题,因为从另一台服务器到慢速服务器的 wget 会显示相同的警告,但速度很快

所有服务器均在 Debian Wheezy 下运行,wget 版本为标准“1.13.4-3+deb7u3”,libgcrypt11 为 1.5.0-5+deb7u5,libgnutls26 为 2.12.20-8+deb7u5

以下是 wget -d 的调试输出

Setting --inet4-only (inet4only) to 1
Setting --check-certificate (checkcertificate) to 0
Setting --output-document (outputdocument) to /dev/null
DEBUG output created by Wget 1.13.4 on linux-gnueabi.

URI encoding = `ANSI_X3.4-1968'
--2016-09-27 22:08:32--  https://127.0.0.1/

******* 这里 wget 等待几秒钟 *******

Connecting to 127.0.0.1:443... connected.
Created socket 5.
Releasing 0x00234188 (new refcount 0).
Deleting unused 0x00234188.

******* 这里 wget 等待几秒钟 *******

WARNING: The certificate of `127.0.0.1' is not trusted.
WARNING: The certificate of `127.0.0.1' hasn't got a known issuer.
The certificate's owner does not match hostname `127.0.0.1'

---request begin---
GET / HTTP/1.1
User-Agent: Wget/1.13.4 (linux-gnueabi)
Accept: */*
Host: 127.0.0.1
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... 
---response begin---
HTTP/1.1 302 Found
X-Powered-By: PHP/5.4.45-0+deb7u5
Set-Cookie: PHPSESSID=g7vo4at63lg6vkmemhjns8uqt3; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: https://127.0.0.1/index.php?r=user/login
Content-type: text/html
Content-Length: 0
Date: Tue, 27 Sep 2016 20:08:42 GMT
Server: lighttpd/1.4.31

---response end---
302 Found

Stored cookie 127.0.0.1 -1 (ANY) / <session> <insecure> [expiry none] PHPSESSID g7vo4at63lg6vkmemhjns8uqt3
Registered socket 5 for persistent reuse.
Location: https://127.0.0.1/index.php?r=user/login [following]
] done.
URI content encoding = None
--2016-09-27 22:08:42--  https://127.0.0.1/index.php?r=user/login

******* 这里 wget 等待几秒钟 *******

Disabling further reuse of socket 5.
Connecting to 127.0.0.1:443... connected.
Created socket 5.
Releasing 0x0022eaf0 (new refcount 0).
Deleting unused 0x0022eaf0.

******* 这里 wget 等待几秒钟 *******

WARNING: The certificate of `127.0.0.1' is not trusted.
WARNING: The certificate of `127.0.0.1' hasn't got a known issuer.
The certificate's owner does not match hostname `127.0.0.1'

---request begin---
GET /index.php?r=user/login HTTP/1.1
User-Agent: Wget/1.13.4 (linux-gnueabi)
Accept: */*
Host: 127.0.0.1
Connection: Keep-Alive
Cookie: PHPSESSID=g7vo4at63lg6vkmemhjns8uqt3

---request end---
HTTP request sent, awaiting response... 
---response begin---
HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.45-0+deb7u5
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: language=de; expires=Wed, 27-Sep-2017 20:08:52 GMT; path=/
Content-type: text/html
Transfer-Encoding: chunked
Date: Tue, 27 Sep 2016 20:08:52 GMT
Server: lighttpd/1.4.31

---response end---
200 OK

Stored cookie 127.0.0.1 -1 (ANY) / <permanent> <insecure> [expiry 2017-09-27 22:08:52] language de
Registered socket 5 for persistent reuse.
Length: unspecified [text/html]
Saving to: `/dev/null'

    [ <=>                                                                                                                ] 6,565       --.-K/s   in 0.008s  

2016-09-27 22:08:53 (801 KB/s) - `/dev/null' saved [6565]

有人知道是什么原因导致了这种巨大的延迟和高 CPL 负载吗?

谢谢 Achim

相关内容