HTTP vs HTTPS performance

后端 未结 22 2003
说谎
说谎 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:56

    There's a very simple answer to this: Profile the performance of your web server to see what the performance penalty is for your particular situation. There are several tools out there to compare the performance of an HTTP vs HTTPS server (JMeter and Visual Studio come to mind) and they are quite easy to use.

    No one can give you a meaningful answer without some information about the nature of your web site, hardware, software, and network configuration.

    As others have said, there will be some level of overhead due to encryption, but it is highly dependent on:

    • Hardware
    • Server software
    • Ratio of dynamic vs static content
    • Client distance to server
    • Typical session length
    • Etc (my personal favorite)
    • Caching behavior of clients

    In my experience, servers that are heavy on dynamic content tend to be impacted less by HTTPS because the time spent encrypting (SSL-overhead) is insignificant compared to content generation time.

    Servers that are heavy on serving a fairly small set of static pages that can easily be cached in memory suffer from a much higher overhead (in one case, throughput was havled on an "intranet").

    Edit: One point that has been brought up by several others is that SSL handshaking is the major cost of HTTPS. That is correct, which is why "typical session length" and "caching behavior of clients" are important.

    Many, very short sessions means that handshaking time will overwhelm any other performance factors. Longer sessions will mean the handshaking cost will be incurred at the start of the session, but subsequent requests will have relatively low overhead.

    Client caching can be done at several steps, anywhere from a large-scale proxy server down to the individual browser cache. Generally HTTPS content will not be cached in a shared cache (though a few proxy servers can exploit a man-in-the-middle type behavior to achieve this). Many browsers cache HTTPS content for the current session and often times across sessions. The impact the not-caching or less caching means clients will retrieve the same content more frequently. This results in more requests and bandwidth to service the same number of users.

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

    HTTP VS HTTPS PERFORMANCE COMPARISON

    I have always associated HTTPS with slower page load times when compared to plain old HTTP. As a web developer, web page performance is important to me and anything that will slow down the performance of my web pages is a no-no.

    In order to understand the performance implications involved, the diagram below gives you a basic idea of what happens under the hood when you make a request for a resource using HTTPS.

    As you can see from the diagram above, there are a few extra steps that need to take place when using HTTPS compared to using plain HTTP. When you make a request using HTTPS, a handshake needs to occur in order to verify the authenticity of the request. This handshake is an extra step when compared to an HTTP request and does unfortunately incur some overhead.

    In order to understand the performance implications and see for myself whether or not the performance impact would be significant, I used this site as a testing platform. I headed over to webpagetest.org and used the visual comparison tool to compare this site loading using HTTPS vs HTTP.

    As you can see from Here is Test video Result using HTTPS did have an impact on my page load times, however the difference is negligible and I only noticed a 300 millisecond difference. It's important to note that these times depend on many factors, such as computer performance, connection speed, server load, and distance from server.

    Your site may be different, and it is important to test your site thoroughly and check the performance impact involved in switching to HTTPS.

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

    Is TLS fast yet? Yes.

    • Watch: https://www.youtube.com/watch?v=0EB7zh_7UE4
    • Read: https://istlsfastyet.com/

    There are many projects out there that aim to blur the lines and to make HTTPS just as fast. Like SPDY and mod-spdy.

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

    A more important performance difference is that an HTTPS session is ketp open while the user is connected. An HTTP 'session' lasts only for a single item request.

    It you are running a site with a large number of concurrent users, expect to buy a lot of memory.

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