Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to reduce ssl time of website

I have an HTTPS website and I want to reduce the SSL time of this website. The SSL certificate has been installed on AWS ELB.

If I access the site from Netherlands, the SSL Time is high but if I access the same site from other countries then the SSL time is low. Why is that?

I am basically trying to minimize the time which is showing in this page

http://tools.pingdom.com/fpt/#!/ed9oYJ/https://www.google.com/index.html

like image 394
user3847894 Avatar asked Apr 17 '16 03:04

user3847894


People also ask

Does SSL slow down your website?

Yes, it's true that SSL can impact the performance of your website. But its efforts are so minor that saving a few milliseconds won't outweigh the increased level of security that SSL affords. With HTTP/2, HTTPS is only getting faster so any performance impact SSL adds to connections is dropping fast.

Does SSL speed up website?

Installing an SSL certificate on your website can have a wide array of benefits. These include enhanced security, improved SEO, and importantly, faster webpage load speed.


3 Answers

Many things influence the SSL time including:

Infrastructure (this won't affect just SSL but ALL network traffic):

  • Standard network issues (how far away your server is from client, how fast the network is in between... etc) as the SSL/TLS handshake takes several round trips. You have little control over these except changing hosting provider and/or using a CDN. AWS is, in my experience fast and you are only asking to improve SSL rather than general access times so maybe skip this one for now.
  • Server response time. Is the server under powered in CPU, Ram or disk? Are you sharing this host? Again general issue so maybe skip past this but SSL/TLS does take some processing power though, with modern servers it is barely noticeable nowadays.
  • Server OS. Newer is better. So if running Red Hat Linux 4 for example then expect it to be considerably slower than the latest Red Hat Linux 7, with improved networking stack and newer versions of key software like OpenSSL.

SSL set up (run your site through https://www.ssllabs.com/ssltest and you should get a state of health of this):

  • Ciphers used. There are older and slower ciphers and faster and new ones. Can get complicated here really quickly but generally you should be looking for ECDHE ciphers for most clients (and preferable ECDHE...GCM ones) and want to specify that server order should be used so you get to pick the cipher used rather than the client.
  • Certificate used. You'll want a RSA 2048 cert. Anything more is overkill and slow. Some sites (and some scanning tools) choose RSA 4096 certificates but these do have a noticeable impact on speed with no real increase in security (at this time - that may change). There are newer ECDSA certs (usually shown as 256 EC cert in ssllabs report) but these faster ECDSA certs are not supplied by all CAs and are not universally supported by all clients, so visitors on older hardware and software may not be able to connect with them. Apache (and very recently Nginx from v 1.11.0) supports dual certs to have best of both worlds but at the expense of having two certs and some complexity of setting them up.
  • Certificate Chain. You'll want a short certificate chain (ideal 3 cert long: your server, intermediary and the CAs root certificate). Your server should return everything but the last cert (which is already in browsers certificate store). If any of the chain is missing, some browsers will attempt to look the musing ones but this takes time.
  • Reliable cert provider. As well as shorter cert chains, better OCSP responders, their intermediaries also are usually cached in users browsers as they are likely to be used by other sites.
  • OCSP Stapling saves network trip to check cert is valid, using OCSP or CRL. Turning it on won't make a difference for Chrome as they don’t check for revocation (mostly but EV certificates do get checked). It can make a noticeable difference to IE so should be turned on if your server supports them but do be aware of some implementation issues - particularly nginx’s first Request after restart always fails when OCSP Stapling is turned on.
  • TLSv1.2 should be used and possibly TLSv1 .0 for older clients but no SSLv2 and SSLv3. TLSv1.1 is kind of pointless (pretty much everyone that supports that also supports the newer and better TLSv1.2). TLSv1.3 is currently being worked on and has some good performance improvements but has not been fully standardised yet as there are some known compatibility issues. Hopefully these will be resolved soon so it can be used. Note PCI compliance (if taking credit cards on your site) demands TLSv1.2 or above on new sites, and on all sites by 30th June 2018.

Repeat visits - while above will help with the initial connection, most sites require several resources to be downloaded and with bad set up can have to go through whole handshake each time (this should be obvious if you're seeing repeated SSL connection set ups for each request when running things like webpagetest.org):

  • HTTP Keep-Alives should be turned on so the connection is not dropped after each HTTP Request (this should be the default for HTTP/1.1 implementations).
  • SSL caching and tickets should be on in my opinion. Some disagree for some obscure security reasons that should be fixed in TLSv1.3 but for performance reasons they should be on. Sites with highly sensitive information may choose the more complete security over performance but in my opinion the security issues are quite complex to exploit, and the performance gain is noticeable.
  • HTTP/2 should be considered, as it only opens one connection (and hence only one SSL/TLS setup) and has other performance improvements.

I would really need to know your site to see which if above (if any) can be improved. If not willing to give that, then I suggest you run ssllabs test and ask for help with anything it raises you don't understand, as it can require a lot of detailed knowledge to understand.

I run a personal blog explaining some of these concepts in more detail if that helps: https://www.tunetheweb.com/security/https/

like image 60
Barry Pollard Avatar answered Oct 02 '22 06:10

Barry Pollard


You can try ECDSA certificates: https://scotthelme.co.uk/ecdsa-certificates/

But the cost of https is only visible on the first requests: session tickets avoid that cost for all other requests. Are they activated? ( you can check it with ssllabs.com )

If you can you should use SPDY or http2, it may improve the speed too.

ECDSA keys, SPDY and http2 reduce the number of round trip necessary so it should reduce the difference between the two location.

like image 41
Tom Avatar answered Oct 02 '22 05:10

Tom


You say that you're not using a CDN, but I believe you should be. Here's why:

Connecting via TLS/SSL involves handshaking a secure connection, and that requires extra communication between the client and server before any data can begin flowing. This link has a handy diagram of the SSL handshake, and this link explains the first few milliseconds of an HTTPS connection.

Jordan Sissel wrote about his experiences with SSL handshake latency:

I started investigating the latency differences for similar requests between HTTP and HTTPS. ... It's all in the handshake. ... The point is, no matter how fast your SSL accelerators (hardware loadbalancer, etc), if your SSL end points aren't near the user, then your first connect will be slow.

If you use a CDN, then the handshaking can be done between the client and the nearest edge location, dramatically improving the latency.

like image 30
Mattias Andersson Avatar answered Oct 02 '22 04:10

Mattias Andersson