Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

Improving Website Performance

Written by: on 21 February 2017 01:22 PM 21 February 2017 01:22 PM

Improving your website for optimal loading times is essentially a culmination of three elements.

VPS vs Shared Hosting

A VPS (Virtual Private Server or Virtual Dedicated Server) gives you a big advantage over shared hosting. You can configure it exactly the way you want to ensure optimal performance. Most importantly you are not affected by noisy neighbors (other busy sites on the same server). A VPS however, only provides benefit gains if you have enough resources to run your site and in the case of cPanel, the cPanel services (mail, DNS, web/apache, spam filtering etc.) effectively.

Once you have a VPS you need to ensure that you get the performance gains available by configuring the elements below. It's important to realise that the server configuration itself will generally only account for about 20% of speed gains, site development will account for about 80% of increased performance. As a result we will look at site performance first.

Site Performance

We are going to look specifically at Wordpress websites, the theories are the same for Joomla, Magento and other CMS based sites. Most CMSs perform quite reasonably out-of-the-box, however, once themes are changed and plugins added they can quickly become an unwieldy beast that is slow to load. Unfortunately many developers focus on the attractiveness of your site, and overlook the performance losses by adding many plugins to ease their development burden. It's important when developing to be aware of site speeds at all times.

Plugins

The first thing we recommend is that you grab a plugin performance profiler such as P3 for wordpress. Use this to determine which plugins are slowing your site down. Remove or disable any you absolutely don't need, or replace them with more efficient plugins that do a similar job. 

* Wordpress P3: https://en-au.wordpress.org/plugins/p3-profiler/

* Joomla: https://www.daycounts.com/how-to/75-how-to-pinpoint-joomla-performance-issues

* Magento Profiler: https://www.atwix.com/magento/finding-bottlenecks/

Themes

Like Plugins third-party themes can affect your site greatly. The best way to see if your theme is the issue is to set your theme back to the default theme (yes it will no doubt break your site and make it look terrible), then check the load times. If the load times are improved then the theme itself is contributing to the site slowness. Put back your regular theme, recheck, and if the result is the same then contact your developer, or considering changing themes. Often third-party purchased themes are not well written and will be slow.

External Content

If your plugins or theme is loading content from an external location, you may find that your server waits until it's got that data before displaying any content, this relies then on an external service, and often overseas. This will substantially slow down your site and should be avoided at all costs.

Site Tuning

Small things can make a big difference with the configuration you set in your .htaccess file. Things to check:

Gzip compression is enabled:

php_flag zlib.output_compression "1"

Your PHP memory limit is high enough:

php_value memory_limit 512M

Server Configuration

Once you have your site optimized, you can look at server modifications that will improve performance. The below is specific for cPanel based servers.

  • Make sure you are running PHP in DSO mode. This is vitally important, if you run in suPHP your site will be very slow. All servers we provision are setup in DSO mode by default.
  • Ensure that your resources are not consumed. If your server is using memory from a swap/paging file, then it will be much slower. This essentially means you ran out of physical RAM and it's now using disk as RAM. RAM is about 100x faster than even SSD performance. To check if your server is using swap file you need to login to WHM and go to Server Status -> Server Information. Look for the section entitled 'Current Memory Usage'. If the 'Swap' line has a 'used' amount then you have crept into your swap file usage. This is not a big problem if it's only a small number of bytes and you still have regular 'free' memory in the 'Mem' line.
  • Check you have enough CPU cores. Unfortunately it's not possible to check the true current CPU usage in WHM, so you will need to login to your server via SSH. Once there type the command: top
    Once top has opened press the '1' key. This will show you your CPU cores and the percent used of each core. If you are utilising them all heavily (e.g. close to 100%) then you should consider adding more cores. If you only have 1 core and it's close to 100% all the time, then adding more CPU cores will definitely help your server and thus your site performance.
  • Installing Nginx. Although Nginx is not officially supported by cPanel, there is a plugin for it available at: http://www.nginxcp.com/
    We also have an article on how to install it here: https://www.vpsblocks.com.au/support/Knowledgebase/Article/View/172/0/installing-nginx-on-cpanel-servers
    Nginx is a proxy that sits in front of Apache and answers all non-https website requests. When it receives a request it checks it's cache and only contacts Apache for the proper page if it doesn't have a recently cached copy. This alleviates load on Apache and MySQL. As this is not supported officially by cPanel however it is possible that some configuration issues occur when cPanel auto-updates itself, although in our experience this is rare.

I hope this article has helped to give you an insight into what you can do to speed up your website performance.

(0 vote(s))
Helpful
Not helpful

Comments (0)