Apache2 with letsencrypt is very slow

apache-2.4http2lets-encrypt

I have a problem with my server configurations,
My site works great with http requests, but when I changed it to https using letsencrypt certificate – to enable http2 – the server became really slow.
a normal request with http will take from 4 to 7 seconds, but when using https most requests (90%) take up to 45 seconds.
I have the latest stable version of apache and I've followed the official docs for installing letsencrypt.

I have been searching for a solution for almost a week, but with no luck, how can this be fixed?

Best Answer

1) Implementing SSL/TLS will naturally have extra latency. This is because the secure communication needs to be negotiated first. So HTTP is faster than HTTPS. But this should normally not cause your 4-7 seconds load time to go as high as 45 seconds.

2) This is not a Let's Encrypt issue. They just provide you with the certificate, like any other CAs out there. Their certificates do not take more time than others to load or negotiate.

3) Check if you have optimized your system already to use SSL/TLS. I suggest you just use 2048 bit keys rather than 4096 bit. All 2048 bit keys are considered safe as per industry standards and 4096 bit would only cost you more processing resources and time. But still, even with 4096 bit, that would not cost your load time to go up to 45 seconds.

You can also refer to Mozilla for some updated SSL directives and Ciphers.

Lastly, consider checking your VirtualHost and SSL configurations /etc/apache2/mods-enabled/ssl.conf. The issue is not directly with your certificate.