5

I bought and implemented an SSL certificate on my website and it seems to load a lot slower than before.

Why does this happen and how can it be fixed?

2
  • 2
    A slow site would become slower, a fast site would still be fast... my own site for example is HTTPS and loads in 0.7 seconds at times, see: tools.pingdom.com/fpt/#!/ciON96/https://www.bybe.net which has room for optimisation. ~ SSL performance is unnoticeable on good hosts, but obviously a secure connection is slower than an unsecure connection due to the complexity of the encryption. Oct 20, 2015 at 16:30
  • Possible duplicate http vs https performance Jul 23, 2017 at 0:15

2 Answers 2

4

This is a question that might be too broad for this platform. It's true that encryption carries a computational overhead, but with the right configuration, it can be negligible.

This video from the middle of 2014 explains quite a bit about common problems and myths about the implementation of TLS, and why it can be slow, and why it shouldn't.

My suggestion is: Set yourself up with a nice top command on the shell and request pages from your server. Watch the performance, and what programs use it. You could also install tools like Firebug (for Mozilla Firefox) and look at the requests performed by a client connecting to your server.

It might also be a problem of shared hosting, if that is your case. In that case, the problem might be out of your reach.

3

Encrypting all the data adds a little computational overhead, but on a decent server this is no issue.

What's really annoying about TLS is that the initial connection takes a long time. You may think that sending a request is as simple as sending a single packet to the server and wait for the response, but it isn't:

  1. First the client needs to establish a TCP connection to the server (this applies to normal http too), then the client gets a response from the server indicating that the connection was accepted. 1 round-trip (sending one packet to the server and waiting for a reply.)

  2. Then the client needs to communicate with the server to establish a secure TLS connections. This involves sending a lot more small packets back and forth. The TLS handshake is longer than the TCP handshake: 2 round-trips and some number crunching.

  3. Using the TLS connection, the client sends the request to the server and receives a reply. 1 round trip + generating the HTTP response which might take a while.


Establishing the initial connection for HTTPS has twice as many round trips as for plain HTTP and a lot more processing on the server.

  • Heavy load on the server makes the increased computations slower.

  • Clients located far away from the server will suffer from the ping time, each round-trip takes one ping time. Plain HTTP takes only 2 pings while HTTPS takes 4 pings.


And just to make matters worse, if a visitor enters your domain name or address without https:// in front of it in their browser, they will first have to make a normal HTTP connection and then get redirected and have to establish a HTTPS connection.

  1. Establish TCP connection to port 80

  2. Send HTTP request and receive a 301 redirect to the https:// version.

  3. Establish TCP connection to port 443

  4. TLS handshake

  5. TLS handshake

  6. Send the HTTP request again and wait for the reply.

That takes 6 pings, some number crunching, and an unnecessary tiny little request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.