r/ProWordPress • • 16d ago

Wordpress+ Woocommerce CPU Spike with low traffic?

I have a client whose site is built on woocommerce + woodmart theme + Elementor, approx 50 plugins with litespeed optimization enabled. I disabled guest optimization as it was adding load to CPU. Previously CPU usage was touching 100% every hour despite having low traffic. I tried query monitor , New relic logs but could not find any solid lead . Can any one suggest any method to fix this ? Admin-ajax.php is showing in log. I am using cloud 4GB ram.

0 Upvotes

13 comments sorted by

3

u/Illustrious-Sir2452 14d ago

100% every hour with low traffic smells like scheduled jobs, not visitors. WooCommerce's Action Scheduler and most plugin crons run on WP-Cron, which fires off page loads (including admin-ajax heartbeats). Check WooCommerce > Status > Scheduled Actions for a pile of pending or failed actions, and use WP Crontrol to see what is set to run hourly. If that is it, set DISABLE_WP_CRON in wp-config and run wp-cron from a real server cron every 5 minutes so the jobs stop stacking up on one request.

1

u/GFXAi 13d ago

Already disabled wp cron and using server cron, not much scheduled pending actions. One setting which made the difference was disabling litespeed's Guest optimization. site is responding slow but CPU is rarely touching 100% .

1

u/PeepSoWP 16d ago

The first screenshot shows request counts, so 43% for admin-ajax.php doesn't establish that it uses 43% of the CPU. That endpoint serves many different callbacks. I'd narrow down one spike before changing more settings.

Ask for the AJAX action values associated with the slow requests, their durations, and one slow PHP trace from the same interval. WordPress dispatches those requests by action. Time get_refreshed_fragments separately too, since it is another large group in your screenshot.

Then compare that interval with due cron/Scheduled Action hooks. An hourly pattern is a clue, but it doesn't prove cron is the cause. Can New Relic show a transaction trace during a spike, rather than only the aggregate URL list?

1

u/GFXAi 16d ago

Thanks for looking into this , i have started new relic again will post logs soon

1

u/toniyevych 2d ago

It's impossible to tell what exactly goes wrong having only those two charts. If you have access to the server's console, I suggest checking what loads the CPU using commands like top or ask support to check.

Aside from that, I'd start with setting up a Query Monitor and checking database queries and external HTTP requests.

1

u/GFXAi 2d ago

I had done everything nothing worked , finally i had to enable WAF level 5 which reduced the spike

0

u/Suspicious_Quote1268 16d ago

Same problem. Same setup.

Fixed with Changing PHP Versions and Installed Modules in the cPanel.
For me it was spiking when trying to update a page or loading the /wpadmin.

1

u/GFXAi 15d ago

Which PHP version are you using ? any specific modules you installed ?

1

u/Flowercloud88 5d ago

Probably check Site Health, it will tell you what required modules are missing that need to be enabled

-1

u/SayedAkhtar_ 16d ago

It's most probably an issue with the recent PHP bug update your installation to the latest php version and check of any open vulnerability of the installed plugins.