- Check your hosting provider.It might seem obvious that it should have been done long before website went live, but there might be some issue that crops up after a while of using current hosting provider. I have been using dozens of different hosting providers in the past (not to mention that at some point I was setting up my own server). What I have learnt during that process was very vital to my websites’ performance. There are many different factors that you have consider in terms of page speed. For this article purposes I will skip many other important other factors (backups, tools, server software etc.).If you’re using a shared hosting, consider getting a dedicated hosting with dedicated IP address. When you have dedicated resources for your website it’s easier to figure out when it’s hosting affecting your website speed as opposed to your own actions. Shared hosting is usually much cheaper than dedicated hosting and it’s not hard to guess why. When your website is on a shared hosting and some other website which is sharing the same resources is generating a lot of traffic, it can affect adversely your website speed. Simply because CPU, RAM or hard drive of the server will not be fast enough to respond to your website’s visitor query.The other important factor to check (even if you decide to stay with shared hosting provider) is CPU and RAM dedicated to your website. If it’s not given in description, you can always ask seller. Based on my experience, hosting providers who offer SSD (Solid State Drive) for both website files and database instead of traditional HDD (Hard Disk Drive), are the fastest and most up-to-speed. HDD uses old technology of spinning platters to store data. An SSD on the other hand uses flash memory and has no moving parts, therefore tends to be much faster.There are many different factors to look at while choosing hosting, e.g. type of databases and software used, but one thing is always easy to remember and easy to check – always make sure that your hosting provider uses the newest PHP available (newer than PHP 7.0), then you can be sure that the hosting provider is keeping their servers up-to-date. If most of your customers are based in UK, make sure to get UK hosting provider – that will reduce server's response time for your customers. Otherwise, please use Content Delivery Networks (explained in step 4).
- Reduce size of images, serve scaled.The next thing you should check is how big are the images that you use on your pages. Images tend to be the toughest for your server. You might think that 300 KiB image shouldn’t affect your server much, but imagine you’ve got 100 of 300 KiB images on homepage, which would give around 30 MiB and then if you have 1,000 visitors per day on your website, it equals almost 30 GiB of requests per day! That’s a huge bandwidth usage.Plugins that are available on WordPress directory, depending on how do you compress your images initially, can decrease size of library by 80% and that’s an amazing relief to your server. Most of the plugins have some free allowance. Some allow you to compress only up to 100 MB for free and after you have used it up, you will be prompted to buy premium version, some have monthly rolling allowance of up to 5 images compressed per month. You can also use several plugins one after another – just make sure not to compress images that have been already compressed by other plugin so you don’t waste your allowance. Some other premium plugins like The Fastest Cache which is meant primarily for caching your website (explained in step 5) come with 1000 credits to reduce sizes of your images.
- Minify your CSS, HTML and JS.
After you have reduced size of your images it is important to make sure other website's resources take as little space as possible. It might not seem that important because that code:
might not seem much lighter than this one:
<div id="site-info" class="site-footer__info pht-box container-a container-a--alt-h"><div class="pht-wrapper"><p class="site-footer__copy pht-layout"> <span class="pht-layout__item u-1-of-2-desk js-pht-waypoint pht-waypoint pht-b2t">© 2017 Artur Kraft - ecommerce specialist</span><span class="site-footer__author pht-layout__item u-1-of-2-desk js-pht-waypoint pht-waypoint pht-b2t">
<div id="site-info" class="site-footer__info pht-box container-a container-a--alt-h">
<div class="pht-wrapper"> <p class="site-footer__copy pht-layout">
<span class="pht-layout__item u-1-of-2-desk js-pht-waypoint pht-waypoint pht-b2t">© 2017 Artur Kraft - ecommerce specialist </span> <span class="site-footer__author pht-layout__item u-1-of-2-desk js-pht-waypoint pht-waypoint pht-b2t"> Thank you for visiting my website! </span> </p> </div> </div> </footer>
- Use CDN if possible. It is highly recommended that you store your images and other big size resources on external servers. When a user goes into your website, (s)he requests from your server all the information necessary to render the website. Resources that take the biggest space are images, java scripts and style sheets – they not only slow down the process of loading the website if downloaded from the same server, but also use your server’s CPU and hard drive. You would want to reduce that unnecessary waste of server's and user’s time. You can do it half-way for free and instantaneously by installing and activating Jetpack plugin (you would need to create free wordpress.com account for that). Then, in settings activate Photon. It uploads all your images to wordpress.com servers and it works straightaway, you don't have to set it up. It's not only that your website will load faster because your heaviest resources are stored on different server, but also your CDN's server location might be closer to end-user than your main hosting server. Unfortunately there is not many free CDNs as they are standalone servers that use a lot of resources to deliver required content. At the time of writing this the only full CDN solutions that is free is offered by Amazon Web Services. They offer their servers to use for free for 1 year as long as you stay within Free Tier usage conditions. It might be difficult for beginners to set this up, so if you require help, I am happy to help you with it.
- Cache your website.WordPress is creating dynamic content for your website and as such requires constant communication with your server for every single user's query. It means that if 10 people load your home page at the moment, WordPress has to ask your server to give them files that are used on that certain page. If one of those users later goes to your contact page, WordPress has to respond to that query as well requesting again all the files from the server and sending them to end-user. This can be heavy on your server if you have hundreds of visitors and your website isn't very optimised. What helps a lot in that case is saving most of the content that repeats itself for most of the users and serve it to them from static files – thanks to that your server will not have to be asked each time one page is loaded, WordPress will just serve static files. This is called caching. There is many very good free plugins that will do that job for you – WP Fastest Cache, W3 Total Cache, Comet Cache just to mention few. What you must remember is that some of these plugins don't recognise when you make important changes to your website (like changing some colours or moving some elements) so you would need to clear the cache from time to time to make sure your users get the latest version of your website.