Virtual Private Servers (VPS) are one of the best hosting solutions for growing websites, providing similar features of a dedicated server at a fraction of the cost. Whilst VPS provide good, overall performance straight out of the box, most people don’t realise that with a few simple optimisations, for example, adjusting default settings and reducing load, they can significantly improve how their website performs. Here are five suggestions to help your VPS hosted website run optimally.
1. Optimise Apache settings
The settings you use on your Apache configuration can significantly impact the performance of your VPS and website. Sometimes, the default settings may not be ideal for the platform your site runs on, and this can cause Apache to use up much of the server’s resources, slowing down the performance of every other process you are trying to run.
Firstly, make sure that your KeepAlive setting is turned to ‘On’. The only reason you shouldn’t do this is if your VPS gets simultaneous requests from large numbers of IPs or if you have a load balanced server. Following this, set your MaxKeepAliveRequests to 100. Finally, ensure that the KeepAliveTimeout value is set at 5.
The StartServers setting dictates the number of child server processes that the VPS creates when booted. This value should be the same as the MinSpareServers setting, which, for VPS is 5.
The MaxClients setting puts a limit on the volume of requests that can be served at any one time. On a VPS, the recommended MaxClients limit should be 150. If you receive connection attempts beyond this number, they will be queued.
Similar to the setting above, the MaxRequestsPerChild setting puts a limit on the number of requests that an individual child server process will undertake. If the volume of requests reaches the maximum specified, the child process will end. For VPS, the recommended maximum is 300.
2. Update MySQL
For both performance and security reasons, it is important to keep your MySQL software up to date. The current version is 5.7, which offers the best read/write workloads and response times. Version 5.6 is also an acceptable version.
If you have a previous version of MYSQL, it can be advantageous to upgrade. If the version you are using is no longer supported, it is advisable to update as soon as possible.
Do note, however, that updating to a new MySQL version is not a simple process to carry out and does demand some fairly detailed technical knowledge. If you don’t have the required experience, you should seek expert help. If you are a WHUK VPS client, contact our customer support who will be able to give you all the technical assistance you need.
3. Use a CDN
Although data travels at phenomenal speed, it still takes time to get from A to B. The further it needs to travel, the longer it takes for your website to load. This means that visitors to your site from further afield might not be getting quite as good a user experience as those nearer to where your VPS is based.
This issue can be solved if you use a content delivery network which stores your website’s static data on a range of servers across the globe. This way, when someone visits your website, they receive much of the data from their nearest server.
Although dynamic data still needs to come directly from your VPS, this can be done quickly as it is not having to send out all the data needed for the page to load. As a result, the visitor gets their web page much faster – which is good for them and for you.
4. Content optimisation
For your website to be rendered on a user’s browser, a lot of content needs to be sent from your VPS to the user’s device. You may have a script heavy theme or lots of plugins, each with their own scripts, all of which have to be loaded before your website can function. The loading of these can slowed down even more by the size of the images on your site, too.
Your VPS can perform the sending of this data much more efficiently if the content of your website is optimised for performance. There are a number of things you can do optimise your content, but these depend very much on the themes, plugins and content you have.
Before making any changes, the first thing you should do is identify which things are slowing your loading times the most. The easier way to do this is to use the free, Google PageSpeed Insights tool.
Simply type in your URL and you’ll be provided with a detailed report showing you how you can improve site speed by making changes to your server settings and website configuration. You’ll get this for your site’s performance on both desktop and mobile browsers.
5. Use Caching
Caching is a well-known technique for speeding up the loading times of websites and can be used with VPS in a similar same way to how it is used on other servers. Without caching, the constant requests for static files can put heavy demands on your resources and slow down your website. Caching these static files to RAM instantly reduces the demands on your server, speeding up other processes and reducing site loading times.
Caching can be achieved through the installation of a range of third-party software products. These include Memcached, an in-memory caching program, designed for websites which rely on databases, for example, WordPress sites, and Varnish, a program that improves the speed of dynamic sites.
If you have been having issues with the speed of your VPS hosted website or you are looking for ways to make your website perform better, hopefully, the advice given in this article will have shown you how that can be achieved.
Adjusting the settings on Apache, updating your MySQL version, using a CDN, optimising your content and caching can all enhance the performance of your VPS hosted website.