HTTPS 与 HTTP 速度比较 [英] HTTPS vs HTTP speed comparison

查看:145
本文介绍了HTTPS 与 HTTP 速度比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个受欢迎的问题,受到的关注比它应该的要多.为了阻止错误信息的传播,请先阅读以下段落和随附的文章:

速度不应成为决定使用 HTTPS 还是 HTTP 的因素.如果您需要 HTTPS 用于您网站的任何部分(登录、注册、信用卡等),您绝对需要 HTTPS 用于所有这些强>,一直.

Speed should not be a factor in deciding whether to use HTTPS or HTTP. If you need HTTPS for any part of your site (log-ins, registration, credit cards, etc), you absolutely need HTTPS for all of it, all the time.

请阅读SSL 与加密无关Troy Hunt 解释原因.

Please read SSL is not about encryption by Troy Hunt for the reasons why.

我考虑在 https 下运行我的整个电子商务网站.我决定运行一个粗略的基准测试来测量 156KB 图像通过 https 与 http 的下载时间,因为我读到 https 会承受来自加密过程的额外开销.

I'm considered running my entire e-commerce website under https. I decided to run a crude benchmark to measure the download time of a 156KB image through https vs http because I had read that https is burdened with additional overhead from the encryption process.

使用 Firefox 的 Firebug 执行基准测试,只需在从空缓存下载图像时将等待"和接收"时间(所有其他时间均为 0)从网络面板转录到 Excel.

Benchmark was performed using Firefox's Firebug simply by transcribing the "Waiting" and "Receiving" times (all other times are 0) to Excel from the Net panel when downloading the image from an empty cache.

我的结果出乎意料:

http: 11.233 seconds
Waiting     Receiving   Total 
1.56        0.88        2.44 
1.55        0.101       1.651 
1.53        0.9         2.43 
1.71        0.172       1.882 
1.9         0.93        2.83 

https: 9.936 seconds
Waiting     Receiving  Total
0.867       1.59       2.457
0.4         1.67       2.07
0.277       1.5        1.777
0.536       1.29       1.826
0.256       1.55       1.806

[明显] 来自基准的观察:

[Obvious] Observations from benchmark:

  • 服务器响应更快,但 https 的下载时间比 http 慢.
  • https 总体上要快很多(约 10%).

<强>谁能解释为什么会发生这种情况?
你认为一个文档(html、css、javascript)会给出不同的结果吗?
有没有人有更好的基准下载方法?





这是测试图像:

Can anyone explain why this would happen?
Do you think a document (html,css,javascript) will give different results?
Does anyone have a better method of benchmarking downloads?





Here is the test image:

[删除测试图片]

附加信息:

  • 该网站位于通过 Godaddy.com 的共享托管帐户上.
  • 如果您打算运行自己的基准测试,请不要添加www"子域...无论如何我都使用根作为静态内容.
  • 在集成管道模式下使用 IIS7.

下面 1px GIF(35 字节)的基准:

http: 2.666 seconds
Waiting     Receiving  Total
0.122       0.31       0.432
0.184       0.34       0.524
0.122       0.36       0.482
0.122       0.34       0.462
0.126       0.64       0.766


https: 2.604 seconds
Waiting     Receiving  Total
0.25        0.34       0.59
0.118       0.34       0.458
0.12        0.34       0.46
0.182       0.31       0.492
0.134       0.47       0.604

结果:https 仍然更快;虽然在这种情况下微不足道.

Results: https is still faster; though trivially in this case.

如果有人发现我的基准测试存在缺陷,请告诉我,以便我发布更好的结果.

If anyone sees a flaw in my benchmark let me know so I can post better results.

因此,在下午 6:00 左右在 Godaddy 共享主机上,通过 https 提供的特定服务器内容比通过 http 提供的速度快.

So, on Godaddy shared hosting at around 6:00pm on my specific server content served over https is faster than over http.

推荐答案

如果你看看你的时间 http 有更大的等待时间和更小的接收时间.另一方面,https 具有更短的等待时间和更大的接收时间.我会将此解释为共享托管服务器上的 http 端口更忙,因此请求在队列中停留的时间更长,直到被服务器接受.一旦接受,请求的传输速度比 https 快.在 https 端口上,服务器上的流量较少,因此请求的处理速度更快,但传输时间更长.

If you look at your times http has bigger waiting time and smaller receiving time. https on the other hand has smaller waiting time and bigger receiving time. I would interpret this as the http port on the shared hosting server is more busy, thus a request stays longer in the queue until is accepted by the server. Once accepted, the requests is transferred faster than https. On the https port there is less traffic on the server so the request is serviced faster but takes longer to transfer.

对于任何 https 与 http 的比较,您必须考虑与 http 相比,为 https 的每个请求握手的时间更长.在执行许多小请求时,您应该会看到情况恶化.

For any https vs. http comparison you'll have to take into account the bigger time to handshake each request for https compared with http. You should see worsening when doing many small requests.

这篇关于HTTPS 与 HTTP 速度比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆