5 Pro Tips To Scale WooCommerce for High Volume Ecommerce Stores
Photo from Convesio
Originally Posted On: https://convesio.com/blog/wordpress-performance/5-tips-scale-woocommerce/
Learn how you can optimize your WooCommerce store to handle spikes in traffic and high-volumes of concurrent transactions and avoid losing sales.
These days, it’s common to read optimization articles that touch on topics such as caching engines and CDNs that cover sunny day scenarios instead of real life traffic overload situations. Some of these articles assume that you have no working knowledge of optimization. Other articles imply that you have some experience, and you can find your way through the maze that is WordPress page speed optimization.
Well, we’re doing things differently this time. In this article, we’ll delve into real-world tactics we have seen in action when hosting and scaling WooCommerce sites that have done thousands of orders per hour and hundreds of thousands in revenue per month.
And although we’re going to share some technical tips, this article is not meant just for a technical audience. We’ll set out to explain technical matters in layman terms, so anybody can understand optimization and apply these tips on their stores and platforms.
Let’s get to it, shall we?
The Importance of Monitoring Software – New Relic
Today, every high-performance store is monitored using specialized software to gain visibility to the inner workings of your site. Managing a server platform without monitoring software is like flying a plane without instruments. It can be done, but when something goes wrong, you’ll have no idea about the nature of the issue causing the problem.
Your site may crash or get slow and you won’t know why. This way you’ll only frustrate your customers and lose the opportunity to find out what really caused the failure… Moreover, running a platform without server monitoring software will cost you considerably in terms of performance and availability, and in the end, your sales will suffer too.
Let’s see about the technical benefits of using monitoring software:
- Visibility of network health and performance
- Access to real world application of user and server data
- Visibility into database performance and internal operations
- Showcase the performance of specific WordPress components
- Monitor overall response time and track its variations
New Relic offers a simple way for developers and sysadmins to work together, sharing the same monitoring data. It includes application monitoring, log management, error tracking, infrastructure monitoring, network monitoring, browser and mobile observation, and alerts data.
Things you can do with New Relic include:
- What part of your website is using the most CPU
- Know how your database is performing
- Find out how many queries are being processed
- Sort how many calls from plugins, pages and website sections are taking place
- Find out overall response time and the variations
- Actually monitor how your website is performing for end users front to back
And when it comes to WordPress, there are other specific datasets you can use to tune your platform.With New Relic you have access to processes data such as:
- Calls to external services
- Detailed by application (meaning plugins running queries) CPU usage
- WordPress hooks related to plugins and features
- WordPress plugins and themes load percentages
However you look at it, New Relic allows you to complete all of your data monitoring tasks in one secure cloud, avoiding data silos and tool sprawling. And all of these data and capacities give you options. They provide a way, a process, to make business decisions that can save you a lot of money.
Let’s consider an example of this for a minute. New Relic gives you access to live WordPress plugins and themes data. From this view, we get a call to a process called wp-external-links which is an external link tracking plugin making 815,000 database calls.
These calls consume traffic and use up database resources. By knowing this, the store WooCommerce store manager can choose to kill the tracking plugin (if it’s not critical) and save money on bandwidth/traffic and potential new hardware expenses.
Evaluate External Integrations
External integrations offer a great way to extend your platform’s capabilities and services. They’re great, but the thing is that measuring the performance of external plugins and homemade software can be a nightmare.
You must know that software such as shipping integrations and third-party integrations can slow down your platform independently of how your WooCommerce setup is performing. Moreover, Integrators aren’t always available during critical business times, and evaluating an integration performance in your platform can be pretty challenging.
And the responsibility of server performance falls on the lap of the WooCommerce and WordPress management team. This means that the platform, Woo/WP, gets blamed for slow performance, and many times it’s not even something in your site that can be slowing you down.
Pro Tip: Take inventory on all 3rd party integration running on your platform and track performance in New Relic. You can also use a tool like GTMetrix to check what external calls are being made by the website and how they affect performance.
But what if external services are taking the most resources? That can happen, especially when under heavy traffic. That is why it’s so important to stress test your servers. Most of the time, you can’t tell when an integration will put your platform under a heavy load.
A quick example comes to mind. A client’s private cloud setup in a local fulfilment warehouse using and off-the-shelf software integration. As a store manager you have to be cautious about this set up. In this case, it was really hard to get visibility into what was slowing down the platform and producing crashes. This lack of visibility could’ve been prevented using New Relic.
I should also mention another useful too which is widely used: GT Metrix. The waterfall view of a report lists the all resources that are being pulled by a page, both from the server as well as external sources. It looks like this:
This is an example of a WooCommerce cart page and we’re looking at the last set of resources from a total of 154. As you can see they are all being executed quickly and concurrently, which is the ideal scenario. The last two, however, refer to Stripe, which is a payment gateway. There is a big delay before they are loaded, which affects the overall page load time. This is an issue worth investigating.
Scheduled Tasks/Cron Jobs
Cron jobs are programmed tasks that take place at a particular time and date. A SysAdmin usually sets up these jobs according to the system load and processes running at different times and the required tasks to be completed.
So, scheduled tasks take memory and CPU resources. If you carelessly program tasks without considering the system’s performance, you’ll clog the platform with jobs that could complete at other times.
Something like that happened on one of our platforms once. An hourly Cron job processing notes from every order caused the system to spike load at the bottom of every hour. This scheduled task went through every order from the last hour and processed notes for specific tasks. This wasn’t a problem during regular sales hours when the Cron job had to look through 10 or 100 notes. But it was a hassle when it came to processing 2,000 notes for a non-mission critical process/function with your server running at 80% capacity.
Can you see how a simple scheduled task can ruin your store’s performance and cause spike loads?
Pro Tip: Use WP-Control to adjust time and intervals. Always consider setting up cron jobs/scheduled tasks during low impact times, just when your system isn’t running any critical processes.
Optimize CPU and Workers
Inside WordPress, PHP workers are processes that build pages and process background tasks, among other jobs. Workers handle requests for web pages and work in combination with other processes such as server-level caching.
CPU means central processing unit, and it’s your server’s brain in charge of all coding and mathematical operations that your OS runs.
There’s a relationship between CPU and PHP workers. CPU power is a hardware setting, and PHP workers is a software setting. PHP workers depend on CPU resources to complete their tasks. So, if you’re having a CPU performance problem, adding PHP Workers won’t help. It will produce a clog, a bottleneck at the CPU level.
See, if you’re having a CPU problem and your hosting provider advises you to add more PHP workers, don’t do it. It will only further your bottleneck. Let’s say you have a pump (CPU in our example) redirecting water to five homes through the pipes in the ground. Then you realized that at each home you’re not getting enough water. Adding another pipe (a PHP worker in our case) won’t give you more water. The problem isn’t the pipes. They can deliver water just fine. The problem is the pump can’t push more water through the pipes.
Sometimes you don’t have many options because scaling your cpu means upsizing hardware, migrating your platform, and changing your billing plan. That’s difficult to do under pressure.
Here at Convesio, we’ve worked out a solution for this bottleneck situation. We give you the ability to scale up workers and CPU resources but also distribute them into a cluster over multiple servers. So, this way you always have a new set of resources available. And this gives you more than enough upward bandwidth to handle your store’s scaling process and new load situation.
Another useful tactic is to have Workers do their thing on the ‘edge’. This means executing them on external network instead on the server WooCommerce is running on. And example most folk are familiar with is Cloudflare’s CDN (Content Delivery Network). One can deploy Cloudflare Workers in similar way, running Javascript functions a) off the server hosting WooCommerce and b) geographically closer to the user. You can read up more about Cloudflare Workers here: Speed Up WordPress With Cloudflare.
Separate DB and Front End WP resources on different physical machines
A database cluster is a setup in which the actual physical servers that host the database are hosted on separate machines. This allows a platform to combine more than one server to respond to database queries and requests. Some of the benefits include load balancing, redundancy, and high availability, which are next to impossible to set up with a single instance database.
Load balancing allows you to easily distribute visitors and requests to your sites to multiple resources.As part of the solution which distributes the front end, WordPress instance and visitors to different machines that do the database work. This results in more available CPU to serve customers.
At this point, a great way to extend performance is to separate the WooCommerce application and its database on different servers. Some of the benefits include:
- Distributing load among multiple server
- Higher system reliability
- Cost-effective hardware usage
- Scalability and a higher level of redundancy
Summing up, splitting the database and the WooCommerce server will help each machine serve more connections and users and free up hardware resources efficiently. It will also help extend performance.
Parting Thoughts
By and large, scaling WordPress and WooCommerce for a high volume of transactions is a complex process of designing, developing and fine tuning your store’s platform. So much fine tuning is required, as WordPress design wasn’t meant to run like we’ve shown you, it’s next to impossible to roll your own solution for high performance stores without any help.
If you were to build this platform on your own you would have to find an engineering team with advanced skills and the cost of developing the platform is prohibitive. But don’t fret. We’ve done all this work for you! With our high performance platform solution it takes three clicks and a few minutes to deploy a high performance store.
Get in touch with us, set up your high volume instance of WooCommerce and see your sales soar!