You can find thousands of tutorials online about speeding up WooCommerce. The problem is that most of them are fundamentally flawed.
It’s actually scary how many of them repeat bad practices, and most of hosting providers distort it in their own ways.
Keep in mind that processes such as:
- Browsing orders and updating their status
- Editing products
- Generating the cart page
- Generating the checkout page
- Placing an order
- Searching for products
- Filtering products
are dynamic, and you can’t “trick” them with caching plugins (WP Rocket, LiteSpeed Cache, or worse yet, NitroPack).
So if you want your WooCommerce to be fast as lightning, welcome to this crash course in WooCommerce optimization! 😉
To achieve a fast WooCommerce, we only need three ingredients:
- A good server, i.e., a machine with sufficient power
- Proper server configuration
- An optimized theme and plugins
Simple, right?
Table of Contents
Server – Our Foundation
How WordPress Works, and Therefore Our WooCommerce Store
On the server, there’s a fairly large directory with WordPress PHP code, plus theme and plugin files.
When a user’s browser sends a request:
- The server reads these files - our codebase.
- Fills them in with the appropriate data from the MySQL database.
- Finally returns an HTML page that the browser can understand.
- The page is displayed in the browser.
- The faster and more modern the processor, the faster this process is completed.
- The more RAM your server has, the better it can handle these requests.
- The faster the server’s disks, the quicker we can read all the files.
- The fewer users sharing the same server resources, the faster the site will be generated.
All these operations rely on hardware. Hardware costs money. Running it costs money too.
That’s why hosting providers often use older hardware and try to spread its resources among as many customers as possible, maximizing their profit. There are just few hosting providers that truly don’t skimp on resources for their clients, but these also tend to be notably more expensive than most of what’s offered on the market for WooCommerce.
Good hardware is expensive. Think about whether the server hosting your store should really have less RAM or a worse processor than the phone on which you might be reading this blog post.
From my perspective, there’s no room for compromise here. A good server costs money.
And that’s a fact you just have to accept if you want truly good and stable results.
In the case of dedicated servers, you know exactly what hardware you’re paying for. You also get the best price-to-performance ratio.
Server Configuration
#GeekAlert!
Even if your machine has sufficient power, you still need to configure it properly. I’ll cover more technical details in a separate post, including how hosting companies drive the popularity of LiteSpeed.
What Should You Know?
A bare, non-optimized-for-WooCommerce server won’t offer impressive performance. The key is to set up sufficient resources for the database to run smoothly and handle PHP correctly. A properly configured OPcache can speed up your store by tens of percentage points.
How I Approach Server Configuration for WooCommerce
Exact configuration can be complex and may vary from store to store due to its unique setup. However, I’ll focus on a few points that are relatively straightforward to implement and monitor, yet can yield a significant difference.
NGINX as the Web Server
I use NGINX for my configurations.
Can WooCommerce run on Apache or LiteSpeed? Absolutely. For WooCommerce, the web server itself will never be the bottleneck.
“Your webserver will not be your bottleneck.”
Calvin Akan, Snicco & CommandUI
“We help people with the REAL bottlenecks every single day. And it’s never the webserver. It’s always some random esoteric crappy code that messes up your PHP or MySQL performance.”
Patrick Gallagher, CEO of GridPane
NGINX is the most popular web server for WooCommerce – that’s why I use it on a daily basis.
PHP OPcache
An absolutely crucial setting, though rarely mentioned in tutorials. A properly configured OPcache ensures that, instead of reading PHP files from disk each time, the code is read as compiled opcode.
Most importantly, this compiled code is read directly from RAM, not from a hard drive.
The difference in read speed means that, with a well-configured OPcache, you can gain dozens or even hundreds of percentage points in page generation speed, especially for large stores with many plugins. It’s a must-have for any fast store, though PHP OPcache is often unavailable on shared hosting.