Skip to content

WooCommerce at Scale

Scaling WooCommerce into a viable enterprise grade solution presents challenges not commonly found with pure WordPress sites. Replacing the search, ensuring good caching, database and query optimization are some of the solutions we tackle.

Published on by Pat Ramsey, Director of Technology

Scaling an eCommerce website to enterprise-grade performance presents a unique set of challenges, unlike scaling up an informational website, such as a marketing site running on WordPress. Using the popular eCommerce platform, WooCommerce (which sits on top of a WordPress install) as an example, when it comes to high-performance you have to look at such situations as logged-in user accounts, up-to-date order information, add-to-carts, coupons, pricing variables, and more. These are on top of scaling issues such as well-written and efficient code, custom database tables, and server infrastructure.

The Challenges of Scaling WooCommerce

Taking the time to properly scale WooCommerce (or eCommerce sites in general), you are dealing with situations that have direct financial impact. According to Kissmetrics, when an eCommerce site brings in $100,000 per day, a single-second page delay can potentially cost $2.5 million in lost sales over a year’s worth of time. Bringing the numbers down a bit, if a site brings in $1,000 per day, a single-second page delay could cost you $25,000 per year in lost sales. This underscores the importance of a well-performing eCommerce site.

So what are some areas to look at in order to understand and improve the performance of a WooCommerce site? Sites running WooCommerce often have at least “some” custom changes made to fit the business needs of a particular store. These are often custom-coded integrations with external services, customized SQL interfaces that don’t use core WooCommerce or WordPress classes, or one-off customizations to a theme that don’t scale under load. The degree and number of customization varies from site to site, making it difficult for any type of “one size fits all” solution. Despite this, there are some approaches that work regardless of the complexity or customization of a site.

Understand Where the Problems Are

It’s hard to fix a problem if you don’t understand it or know where it lies, especially when it involves sales and incoming revenue - real money. An audit of your site, gathering as much information about the code, the server, the services running, and integrations, is the best first step. Once you gather all of this information, you have real data and can better identify where problems are happening. Server information might include such data as slow query logs or New Relic application and query information. The WordPress plugin, Query Monitor, is also a handy way to identify which areas where things might be running slow on different pages. Is the slow-down when a product is added to the cart? Is it when you are working with product variations? Maybe it’s when coupons are being applied or you view orders in My Account. Studying the system process and interactions in various parts of the checkout flow can help reveal specific areas that need work.

If you have not performed any load testing on your site you’ll want to do this as soon as you can. Mimic the different types of sales activity with a load testing service or tool to see what happens when your site sees exponential growth in visits and activity. This is something you’ll ideally want to do using a staging server or other type of clone other than your live site. Load testing, ahead of a busy time such as Black Friday or Cyber Monday, can be a good way to better identify where things break down before they break down in a live site. If you introduce new functionality, integrations or other changes to the system, once it is working well, test it again. You have new variables in your system and you need to be certain things continue as you assume they will.

Where Are You Saving Data?

WordPress by default stores all post types (these are pages, posts, products, etc) in a single database table, with a second table for all post meta content. This might work well on a non-eCommerce site, and even a small-volume WooCommerce site. As eCommerce volume increases, having all the content in just two database tables creates a performance bottleneck. Eventually you will see orders fail, customers may not be able to add items to the cart, or you experience any number of other failures. All of these examples get in the way of your store making money.

After studying where you’re seeing database bottlenecks you might need to consider creating custom database tables. Doing this allows you to save content such as products in separate database tables, instead of mixed in the default wp_posts and wp_postmeta tables with everything else. With products in their own tables, it’s now possible to optimize SQL queries for faster load times due to performant database queries. For example, database inserts, where you are writing content to the database, require fewer queries to save the same amount of content. A lower volume of queries leads to less time required talking to the database server and an improvement in website performance, as the site does not have to process as much information per query.

Upgrading From Older Code

A common area of risk when working with WooCommerce is when you have inherited an older site, one that might not have been written as well as it could have been. As WooCommerce has matured, some older functions and processes have been replaced with better, more modern code. Legacy custom sites might perform poorly when the core WooCommerce code is updated.

In these situations, deprecated, or outdated, functionality needs to be identified and replaced with newer code either from WooCommerce Core, or custom code that is developed following current practices and standards. This is an area where solid code documentation can be critical in “future-proofing” your work as best as can be done. The better the documentation of what code does, the easier future upgrades become.

Replacing Default WordPress Search

WordPress’ built-in search is built on a set of queries to the database. At scale, this might not be the best solution for your complex site searches, filtering of results, or custom content pages. Custom solutions that integrate well with WordPress might be a better answer. Elasticsearch or Algolia are alternative site search engines that may perform better in the higher-volume sites through custom integrations. These engines offload the creation and management of search indices, freeing those database queries from being something the website has to deal with. In addition to powerful site search, highly complex WordPress pages may require overly large query arguments to pull all the individual pieces of page content together. With these high-performing search engines, it can be possible to use them, instead of directly querying the CMS database,to build pages from complex types of content.

What Works for WordPress Might Not Work for WooCommerce

One of the most common pieces of advice for improving site performance is to make sure you use good page caching. While true, well-built caching solutions are great for front-end performance, you should keep in mind that caching does not fix poorly-written, or non-performant, code. Caching makes that code run faster, not necessarily better. With WooCommerce, it’s not good to cache everything. Several parts of the site need to be excluded from cache in order for up-to-the-minute actions and dynamic updates to work properly. The Cart and Checkout pages, for example, have to be excluded from cache, meaning all the updates to those pages involve active transactions with the database, as customers go through the store. Simply caching the whole page, without the right planning and exclusions might prevent a visitor from seeing the correct checkout or order information.

In a traditional WordPress site, a common practice is for logged-in users to be excluded from static page caching. The idea being that if you are logged into WordPress, you are most likely creating content and should see a non-cached site. However, WooCommerce customers are typically logged-in to WordPress, as a type of user within the CMS. With traditional page caching, this creates a problem at scale, so more complex caching solutions are required.

Another key difference involves backups. With a traditional WordPress website that does not have hundreds or thousands of transactions happening in short periods of time, regular backups taken every 24 hours are probably fine. If your site has thousands of customers making orders and purchases every few minutes, your backup needs are far more complex. Simply restoring en masse a WordPress database no longer works. If you run backups every hour, you can lose a lot of order information by doing a restore of the most recent backup. The volume of your site may require solutions such as syncing order information in real-time to a secondary system, allowing you to maintain a separate copy of the most volatile data in the case of something happening to your site. If you use custom database tables for your site, you can set up custom backups for them, apart from any traditional process.

Do not forget about restoring your backups. A solid backup strategy should include detailed restore steps and should be tested regularly. If your backup can not be restored successfully, you don’t have a backup, you simply have a large useless file.

Creating custom experiences

There is a reason eCommerce is not the easiest thing in the world - you are dealing with people’s hard-earned money and all the emotions that can go along. As a store owner, you want the experience to be smooth and easy whether you have one customer or millions. When your site has problems, the trust people have in giving you money is eroded and you stand to lose orders. Creating a positive shopping experience, from small site to large-volume store, requires thought, planning, and customization. This is something dedicated enterprise eCommerce providers such as BigCommerce understand and is why they show up at the top of the list.

Some of the smartest technical minds have shown that with the right planning and approach, you don’t have to rely on third-party eCommerce providers in every case. WooCommerce and WordPress can power your eCommerce from store opening through Black Friday and beyond.

If you have any questions or would like to discuss scaling your WooCommerce solution, Contact us.