我有一个远程服务器,这是大约390毫秒的ping延迟。 服务器是nginx与ssl(spdy / 2)。 当我使用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秒)。
只是想给出一个答案来解决这个问题:Chrome重用SSL会话(所有选项卡共享相同的networking进程),所以它绕过我的testing中的TLS握手。