Web development Birmingham

Test and Improve slow website connection requests / SSL handshaking

By Andrew Ward By Andrew Ward Jun 11, 2014 web development, seo

If you run your own servers then you may look at your website loading speed and contemplate how you can make it faster. The obvious things are to optimise images sizes, cache scripts and to ensure MySQL indexes are in place for the most used columns. Tools such as Google Insights can be used to measure and give suggestions for fixing all of this sort of stuff, but what if your site is still feeling sluggish?

It could well be that your websites connection requests are running slowly. You can check these in web browser debugging tools though a better way is through Pingdom Tools. This allows you to see all of the connections for every asset on a particular web page and how your server performs in various categories. At the time of writing you can see Scorchsoft performs pretty well:

Pingdom results for scorchsoft.com

But why it this? Well firstly we have done a load of the Google Insights optimisations, but by far the biggest reason for this boost is that we have improved the server response times themselves. Pingdom also provides data around each request that looks something like this:

pingdom request data

See the little blue section of the bar? This is the connection time, i.e. the time it takes for your web browser to be able to hand shake with the web server. If these blue bars are particularly long then you have a connection related issue on your hands. One common thing is to see the early bars in the list as having a quick connection, but later ones taking much longer. This is usually down to how your Apache is configured to handle parallel requests.

The quick-fix

There is one very simple thing you can try to drastically improve the connection performance:

Set Keep-Alive to ON in your Apache configuration (httpd.conf)

If you know how to edit your httpd.conf file then great, if you don't then you can also set this value from within WHM by navigating to "Home > Service Configuration > Apache Configuration > Global Configuration".

When we first did this we saw our average SSL connection time (from browser to server) drop from 500ms to 50ms, A tidy 1000% performance improvement. 

So what does this do?

Every time your web browser requests a file or resource from the server there is a handshaking process and a connection is established. If keep alive is OFF then this process is executed for every connection made, if it is set to on then it keeps the connection alive for a period of time. It kind of makes sense really, why handshake so many times when loading a single web page, doesn't it make sense to do the one handshake that covers everything you need in loading that page? We think so.

There are some trade-offs to understand. In enabling keep-alive you are sacrificing some RAM to reduce CPU usage and decrease http(s) connection time. It does depend on the nature of your site/application though seeing how RAM is so cheap these days it really does seem to be a trade off worth taking in most cases. 

Still stuck?

You may not be a techy and have a website that has poor performance due to the above reasons. Why not get in touch to see if we can migrate your website to a hosting environment that not only gives you more control but that performs better than your current offering.

You may also be interested in our more recent article on testing and improving the performance of your website.

Did you find this article useful? Sharing is a great way to show support, and ensures that we can continue to create more quality articles:

Get a free quote