为什么 Chrome 在 SSL 中获取文件的速度如此之快?

为什么 Chrome 在 SSL 中获取文件的速度如此之快?

我有一个远程服务器,ping 延迟大约为 390 毫秒。该服务器是带 SSL (spdy/2) 的 nginx。当我使用 curl 获取小资源时,通常需要 2 秒。

* About to connect() to i.vtcdn.com port 443 (#0)
*   Trying 115.84.182.206...
* connected
* Connected to i.vtcdn.com (115.84.182.206) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-SHA
* Server certificate:
*    subject: description=xEM5CLkye0fR7K9Q; C=FR; CN=i.vtcdn.com; [email protected]
*    start date: 2012-08
*    expire date: 2013-08
*    subjectAltName: i.vtcdn.com matched
*    issuer: C=IL; O
*    SSL certificate verify ok.
> HEAD /sites/all/libraries/requirejs/require.js HTTP/1.1
> User-Agent: curl/7.27.0
> Host: i.vtcdn.com
> Accept: */*
> 
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: nginx/1.4.1
Server: nginx/1.4.1
< Date: Tue, 14 May 2013 22:12:40 GMT
Date: Tue, 14 May 2013 22:12:40 GMT
< Content-Type: application/x-javascript
Content-Type: application/x-javascript
< Content-Length: 14845
Content-Length: 14845
< Last-Modified: Sun, 19 Aug 2012 17:50:13 GMT
Last-Modified: Sun, 19 Aug 2012 17:50:13 GMT
< Connection: keep-alive
Connection: keep-alive
< Vary: Accept-Encoding
Vary: Accept-Encoding
< ETag: "50312755-39fd"
ETag: "50312755-39fd"
< Expires: Thu, 13 Jun 2013 22:12:40 GMT
Expires: Thu, 13 Jun 2013 22:12:40 GMT
< Cache-Control: max-age=2592000
Cache-Control: max-age=2592000
< Accept-Ranges: bytes
Accept-Ranges: bytes

< 
* Connection #0 to host i.vtcdn.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

在 Chrome 中,只需不到一秒钟:

截屏

我认为这是不可能的。有任何预取吗?在页面中获取此脚本时,我也得到了一致的结果(主 HTML 在服务器端需要 1 秒钟来处理并返回,然后 JS 文件在 2 秒标记之前完成加载,因此本身仅需 1 秒左右)。

答案1

只想给出一个答案来结束这个问题:Chrome 重用了 SSL 会话(所有选项卡共享相同的网络进程),因此它在我的测试中绕过了 TLS 握手。

相关内容