Improve Wordpress Speed

HOW TO IMPROVE WORDPRESS SPEED AND TTFB

PREPARE THE BASICS FIRST

We will consider in this scenario that you are already running an Wordpress + Woocommerce installation on a VPS with Debian/Ubuntu OS and Apache2 web server.

1
2
3

Make Sure Of The Basics

It is important to be sure that all minimum system requirements are met so that we don't adventure in dust wiping while the elephant is in the room. Make sure you are running on latest PHP version, make sure you are running on FastCGI environment. For a production setup on the starter side with low traffic, I would recommend at least 2GB RAM and 2 vCPUs to rule out any possible bottle necks.

Make Sure Your Installation Has No Issues

We need to make sure that our installation is healthy, check the appropriate Wordpress tools for scanning the health of the website and if any PHP modules are missing, install them if any is missing, optimize the database with MySQL commands and carefully scan the plugins and possibly remove the unwanted or those that you can survive without. More plugins, more bloat on the front-end and additional loading time.

Update your VPS Server

I know, this makes no much difference but we need to be up to date with all the modules and packages, so running a: apt-get update && apt-get upgrade will not hurt. An other important thing is to run always on SSD drives, never accept to run your production server on spin drives, those extra IOPS will come very handy in the long run. So better to grab a new VPS then working on an outdated with spin drive HDD.



LEARN WHAT MAKES WORDPRESS SLOW

This applies in general to all wordpress + woocommerce installations.



Time To First Byte

Short answer, TTFB depends on 2 elements: Server Location and Number Of Requests

Server Location - If your target audience is in California and your website is hosted in Germany, expect a high TTFB. The request from the user and response from the server will go through many hops, many networks, routers, switches for the round-trip of the information. This will cause an awful TTFB and there is not much to do at this point.

CDN should solve this right? - Not always, especially if we are speaking about Wordpress + Woocommerce, a complex system. CDN would be fine in the case of static pages serving but we can not avoid completely the requests and response from the server of origin, like the action Add to Cart or localization services, these can not be static and will always cause delays and poor performance when the server location is far from the customer.

Number Of Requests - A high number of requests will cause a higher TTFB, despite the speed these requests can be handled by the server there will still be an initial "freeze" from the server to respond to the request and this adds up to other factors. After all we are speaking of hundreds of milliseconds, anything can add up. A high number of requests is mainly caused by CSS and JS that needs to load for your website to function properly and look appealing. Also other elements add up like fonts, pixels, analytic trackers, number of images.

General Poor Performance

Ruling out the basics, the poor performance is caused by bad themes and plugins.

A bad theme is possible - No one wants to hear this, especially if you are already running your e-commerce store and have spend so much time in fine tuning visual aspects that this sounds frustrating. But think of this, what if your theme is a bottleneck jeopardizing the future of your e-commerce activity? Would you allow that? It is better to spend one more week in fine tuning a new theme than spending a lot of money in advertising a website that people can hardly navigate. At this point we would suggest to make research on Google for fast themes, there are many you currently ignore and can boost the current performance by a lot. We have seen this, is no luck, no mystery, a better theme will have better performance all around.

Those Bloody Plugins - When you are starting out for the first time, the plugins seem the best thing ever, you just install something and that functionality is automatically added to the website. But, after ending up installing 20 plugins (which is quite possible) and your site looks perfect for you, you start to see the other side of the medal. Your site is slower, requests are much more, more JavaScripts and CSS to load for just that simple function. No one can suggest you which one to remove but you have to make a compromise, keep the most essentials and remove what can be removed. Think of the business side, how much that specific plugin is helping business wise? If not much then just deactivate and delete it.


LEARN WHAT MAKES WORDPRESS FAST

This applies in general to all wordpress + woocommerce installations.



Server Location Is The Key

Just because the website runs fine for yourself, it does not mean it runs fine in an other continent. You will be surprised of how drastic the difference is.

We all want to be as global as possible but it requires very advanced setup with load balancing, different servers in different locations so that the user is served automatically with the server closer to him. This kind of setup is out of the scope of this information page.

If your audience is in Europe your server should be in Germany - This applies especially to Wordpress + Woocommerce, being enough complex systems themselves, it is a MUST. If you ignore this step, all the rest will be futile and just improve the performance for the audience located in proximity to the server.

Theme is Very Important

If your theme is not good, all other optimizations will be futile. No optimization can beat a bad code, this is a rule. Research for faster premium themes and grab one that fits you best which is lighter, cleaner and faster than your current one (if that's the situation).

As said earlier, deactivate as many plugins as you can. Think of it business wise, is that plugin bringing any benefits to the business? Do you really need automatic currency exchange if you target UK only? Do you really need languages plugins? Make some questions if a plugin is really useful and disable/delete as many as possible.

Use a Caching Plugin

This is where the performance starts, the caching plugin will create static pages and serve those pages much faster because they will not be dynamically generated by PHP. This is extremely important. We recommend using WP Rocket plugin, it will also optimize the delivery of CSS and JS by deferring their delivery. This will improve considerably the scores on website speed testing.

Other optimizations methods are possible with WP Rocket for even more performance, but you have to test because they might break functionalities of the website. The most notable would be the concatenation of CSS files and JS files in fewer files, reducing the number of requests drastically. It will also result in huge improvement in the speed testing scores. However as said earlier, you will still need to be careful if these optimizations breaks any functionality or visual alignments.

Speed testing website will give scores which are based on their algorithms and not always represent the best evaluation. What is important to note is the actual website loading speed or Time to Interactive which will directly impact the user's experience.

Enable HTTP/2

To put this short and simple: you need to enable HTTP/2 because differently from the HTTP/1.1 it can allow multiplexing of responses. So, if your website has 100 requests (CSS, JS, Images, Fonts), with HTTP/2 your server can serve to the customer's browser all simultaneously and is obviously a huge benefit. With HTTP/1.1 each request had to finish delivering for the next one to start.

To enable HTTP/2 on Debian 10 using PHP 7.4 you can read this short tutorial.
To enable compression on Apache2 you can read this other short tutorial.

Content Delivery Network

Using a CDN is highly recommended as it will deliver the static content much faster than your own server because they have servers closer to your target audience. Consider a good CDN like Cloudflare, KeyCDN, etc.

OpenLiteSpeed Web-Server

In this topic we need to mention this! There is much more than this short guide to be done for improving your website's performance. Another outstanding approach would be to use a different web server, namely OpenLiteSpeed. It will improve the performance massively, although it requires some more experience for fine-tuning it.


Want to host or migrate your website to us?

Freely contact and tell us about your project and difficulties, we can help you get the best configuration and setup for your business website.

Our offer includes: Dedicated Servers, Cloud VPS, Storage Space, etc.
Performance: 100% Gigabit network, Server grade SSD drives, absolute performance.
Locations: Our native data-center location is in Germany and Finland but we can also allocate in USA if there is any request.
Pricing: Our prices are exceptional, especially for dedicated servers we have unbeatable offers.