Raza Gillani.
Web Development

WooCommerce High CPU Usage Fix: A Technical Diagnostic Guide

R

Raza Gillani

Web Development

October 29, 20265 min read

To fix WooCommerce high CPU usage immediately, stop relying on generic caching plugins and address the four root causes behind resource exhaustion: bloated Action Scheduler tables, runaway wp_options autoloaded data, unthrottled admin-ajax.php requests, and missing database indexes for custom queries. Fixing these issues reduces CPU load at the database level and stops server crashes during traffic surges.

Over ten years of optimizing high-volume stores built on WooCommerce development, I have seen CPU spikes crash servers right when order volume peaks. Below is the exact step-by-step diagnostic workflow I use to stabilize resource-heavy WooCommerce stores.

1. Clean Up Action Scheduler and Transient Bloat

WooCommerce relies heavily on the Action Scheduler background process to handle webhooks, subscription renewals, email notifications, and inventory updates. When these tasks fail or queue up faster than the cron process can clear them, the database table wp_actionscheduler_actions can swell to hundreds of thousands of rows.

Every time a background task runs, MySQL scans these massive tables, driving CPU consumption to 100%. Check your database via SSH or phpMyAdmin:

SELECT status, COUNT(*) FROM wp_actionscheduler_actions GROUP BY status;

If you see thousands of failed or pending tasks, purge completed and canceled jobs, and log into your server CLI to execute WP-CLI commands:

wp action-scheduler run --batch-size=500
wp action-scheduler purge

Next, check for expired transients in wp_options. WooCommerce extensions often write temporary state data to wp_options without clearing expired keys, inflating database queries on every page request. You can safely clear expired transients using WP-CLI:

wp transient delete --expired

2. Optimize Autoloaded Options in wp_options

One of the most frequent causes of a slow WooCommerce checkout and high CPU usage is an oversized autoloaded payload in wp_options. Every non-cached PHP execution loads every option where autoload = 'yes' into memory.

If your total autoloaded data exceeds 800 KB, your database engine wastes CPU cycles serializing and transferring this data on every request. Run this query to calculate your current autoload size:

SELECT SUM(LENGTH(option_value)) / 1024 / 1024 AS autoload_size_mb FROM wp_options WHERE autoload = 'yes';

If the result is high, find the largest autoloaded options:

SELECT option_name, LENGTH(option_value) AS option_size 
FROM wp_options 
WHERE autoload = 'yes' 
ORDER BY option_size DESC 
LIMIT 20;

Identify options left behind by deleted plugins or bloated log tables (such as session data or transient arrays) and set their autoload status to no or delete stale records entirely.

3. Tame admin-ajax.php and WooCommerce Heartbeat

If your server monitoring shows CPU usage spiking when users are actively browsing or when staff members log in, admin-ajax.php is often responsible. This issue frequently creates a slow admin panel or triggers PHP worker starvation.

WooCommerce uses AJAX for fragment loading (updating cart totals across cached pages) and heartbeat polling in the dashboard. To fix this:

  1. Disable Cart Fragments on Non-Cart Pages: By default, WooCommerce executes an AJAX request (wc-ajax=get_refreshed_fragments) on every page load to keep the cart widget updated. Use a custom snippet or child theme function to dequeue this script on pages where a floating cart is unnecessary.
  2. Throttle the Heartbeat API: Install a control plugin or add a filter to limit the WordPress Heartbeat execution frequency to every 60 seconds, or disable it entirely on the frontend.
  3. Use Native Cron: Disable default WP-Cron (define('DISABLE_WP_CRON', true); in wp-config.php) and schedule a real system cron job via server control panels like Hestia CP every 5–10 minutes.

4. Identify and Fix Slow MySQL Queries

When WooCommerce product catalogs grow, default database queries searching through postmeta and order attributes become expensive. Unindexed queries force MySQL to perform full table scans, spiking CPU utilization.

Enable the MySQL slow query log in your database configuration (/etc/mysql/my.cnf or equivalent):

slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 1

Review the log output or analyze it using mysqldumpslow to find queries spending significant execution time on wp_postmeta or wp_woocommerce_order_items.

Implementing WooCommerce High-Performance Order Storage (HPOS) moves order data into dedicated database tables designed specifically for transaction volume, cutting down heavy wp_postmeta joins.

5. Implement Redis Object Caching

Page caching alone cannot solve high CPU usage for logged-in users, checkout workflows, or administrative tasks because those requests bypass the page cache entirely. To drastically cut down database reads and CPU overhead, implement persistent object caching using Redis.

When configured alongside AWS EC2 hosting, Redis stores database query results in RAM. Subsequent requests for product metadata, site options, and user sessions load directly from memory rather than executing duplicate SQL queries.

For a broader overview of optimizing technical performance and server infrastructure, explore our technical SEO guide and our guide on fixing Core Web Vitals.

If you are evaluating whether your current store structure can handle future growth, reading our comparison on WooCommerce vs Shopify performance provides additional architecture insights.

Frequently asked questions

Why does WooCommerce cause high CPU usage on my server?

WooCommerce triggers frequent non-cacheable database queries through cart updates, customer sessions, background processes, and admin tasks. When database tables like wp_options or Action Scheduler accumulate stale data, or when unindexed queries run repeatedly, CPU usage spikes as MySQL struggles to process the requests.

How do I stop admin-ajax.php from overloading my CPU?

You can reduce admin-ajax.php resource consumption by disabling WooCommerce cart fragments on pages where they are not required, limiting the frequency of the WordPress Heartbeat API, and replacing default WP-Cron execution with a server-level crontab entry.

Will adding more CPU cores fix a slow WooCommerce store?

Adding CPU cores provides temporary headroom, but it does not fix underlying bottlenecks like unindexed database queries, massive autoloaded options, or runaway cron tasks. Without optimizing the database and application layer, a busy WooCommerce store will eventually exhaust hardware upgrades.

How does Redis object caching help reduce server load?

Redis stores recurring database query results directly in system memory. Instead of executing complex MySQL joins for product details or site options on every request, WordPress retrieves the data instantly from Redis RAM, significantly lowering database CPU load.

If your WooCommerce store is crashing under traffic or suffering from persistent high CPU usage, book a consultation via our /lets-talk page for a complete server and database audit.

R

Written by Raza Gillani

Digital marketing specialist & website developer with 10+ years of hands-on experience across SEO, WordPress development, and AWS server management.

Ready to Apply This?

Reading about it is one thing — let's build it.

If any of this sounds like your business, let's talk about what's actually holding your website or marketing back.

Let's Discuss Your Project