HTTP vs HTTPS performance

后端 未结 22 2005
说谎
说谎 2020-11-22 10:30

Are there any major differences in performance between http and https? I seem to recall reading that HTTPS can be a fifth as fast as HTTP. Is this valid with the current g

相关标签:
22条回答
  • 2020-11-22 10:41

    In a number of cases the performance impact of SSL handshakes will be mitigated by the fact that the SSL session can be cached on both ends (desktop and server). On Windows machines for example the SSL session can be cached for up to 10 hours. See http://support.microsoft.com/kb/247658/EN-US . Some SSL accelerators will also have parameters allowing you to tune the time the session is cached.

    Another impact to consider is that static content served over HTTPS will not be cached by proxies, and this may reduce performance across multiple users accessing the site over the same proxy. This can be mitigated by the fact that static content will be cached at desktops as well, Internet Explorer versions 6 and 7 cache cacheable HTTPS static content unless instructed to do otherwise (Tools Menu/Internet Options/Advanced/Security/Do not save encrypted pages to disk).

    0 讨论(0)
  • 2020-11-22 10:42

    The HTTPS indeed affects page speed...

    The quotes above reveal the foolishness of many people about site security and speed. HTTPS / SSL server handshaking creates an initial stall in making Internet connections. There’s a slow delay before anything starts to render on your visitor’s browser screen. This delay is measured in Time-to-First-Byte information.

    HTTPS handshake overhead appears in Time-to-First-Byte information (TTFB). Common TTFB ranges from under 100 milliseconds (best-case) to over 1.5 seconds (worst case). But, of course, with HTTPS it’s 500 milliseconds worse.

    Roundtrip, wireless 3G connections can be 500 milliseconds or more. The extra trips double delays to 1 second or more. This is a big, negative impact on mobile performance. Very bad news.

    My advice, if you're not exchanging sensitive data then you don't need SSL at all, but if you do like an ecommerce website then you can just enable HTTPS on certain pages where sensitive data is exchanged like Login and checkout.

    Source: Pagepipe

    0 讨论(0)
  • 2020-11-22 10:43

    I can tell you (as a dialup user) that the same page over SSL is several times slower than via regular HTTP...

    0 讨论(0)
  • 2020-11-22 10:46

    The overhead is NOT due to the encryption. On a modern CPU, the encryption required by SSL is trivial.

    The overhead is due to the SSL handshakes, which are lengthy and drastically increase the number of round-trips required for a HTTPS session over a HTTP one.

    Measure (using a tool such as Firebug) the page load times while the server is on the end of a simulated high-latency link. Tools exist to simulate a high latency link - for Linux there is "netem". Compare HTTP with HTTPS on the same setup.

    The latency can be mitigated to some extent by:

    • Ensuring that your server is using HTTP keepalives - this allows the client to reuse SSL sessions, which avoids the need for another handshake
    • Reducing the number of requests to as few as possible - by combining resources where possible (e.g. .js include files, CSS) and encouraging client-side caching
    • Reduce the number of page loads, e.g. by loading data not required into the page (perhaps in a hidden HTML element) and then showing it using client-script.
    0 讨论(0)
  • 2020-11-22 10:46

    The current top answer is not fully correct.

    As others have pointed out here, https requires handshaking and therefore does more TCP/IP roundtrips.

    In a WAN environment typically then the latency becomes the limiting factor and not the increased CPU usage on the server.

    Just keep in mind that the latency from Europe to the US can be around 200 ms (torundtrip time).

    You can easily measure this (for the single user case) with HTTPWatch.

    0 讨论(0)
  • 2020-11-22 10:47

    Since I am investigating same problem for my project, I found these slides. Older but interesting:

    http://www.cs.nyu.edu/artg/research/comparison/comparison_slides/sld001.htm

    0 讨论(0)
提交回复
热议问题