Problem – Slow WordPress admin panel, Slow site, and High CPU Usage
The problem that we faced and many others might be facing with the rapid increase in the size of WordPress database table “wp_actionscheduler_actions” in a day or two the size of this table increased to 5GB. Actually, the problem is that the woocommerce schedule action is been performed every 15 min and the continuous performing of this action is putting a load on the server. Some action scheduler might be running. Such as “wc_facebook_regenerate_feed” scheduled to run every 15 minutes.
Also Read “10 Easy Ways To Speed Up WordPress Website“
Following are the tables that will be increasing in size rapidly,
- wp_actionscheduler_actions
- wp_actionscheduler_claims
- wp_actionscheduler_groups
- wp_actionscheduler_logs
wp_actionscheduler_actions table in database – phpmyadmin. This table increased to 35G for me and upon googling, it increased to 55GB for some people. I used to empty the table every day. It was around 4GB every day.
Trial and error – Problem unsuccessful steps.
If we disable the Woocommerce plugin, the server load will be reduced to normal and the site WordPress admin panel will respond normally, but obviously, without woocommerce, an eCommerce website will be useless. We tried deactivating all the plugins and reactivating them one by one. At first, the website and admin panel responded but then after a few minutes, it went back to normal. So we shortlisted that the problem is not with any other plugin. We were afraid to disable the woocommerce plugin because the site was totally customized. We took a backup and finally deactivated the plugin. Please note, we were not able to deactivate any plugin via the WordPress plugin page. Instead, we used the file manager from our server and renamed the plugins. Like renaming the plugin “woocommerce” to “-woocommerce” will deactivate the plugin in WordPress. Now we are sure the problem was with woocommerce. We also tried Query monitor, it also pointed us to woocommerce plugin. We knew that “wc_facebook_regenerate_feed” which was running after every 15 min was the culprit and somehow it needs to be either stoped or removed. “wc_facebook_regenerate_feed” was causing the rapid increase in size for database table “wp_actionscheduler_actions”
Is your website hacked? Read “What to Do When WordPress Site Got Hacked and Fix it“
Finally The solution – Stop recurring tasks.
Finally, after a lot of trial and error, we were able to resolve this issue. Simply add the following code in the theme file, in function.php file. We added the code on the main and not the child, if you want you can try on the child theme function.php file and let us know in the comments if it worked for you. But for us, it worked. This code increases the time of the scheduler from 15 minutes to 24 hours. 3600 is basically 3600 seconds, which is equivalent to one hour, So it’s 24 hours interval. You can play around to increase or decrease the time interval. If there are any other hooks or schedulers that might be giving issues to you. Simply replace “wc_facebook_feed” with what so ever is causing you the issue.
See the continuously running the hook/scheduler “wc_facebook_feed” after 15 minutes or whatsoever scheduler is in your case. It did not only increase the size for a database table in or WordPress for “wp_actionscheduler_actions” to GBs but it was also consuming CPU resources resulting in slow site response and slow WordPress admin panel response.
Having Trouble installing WordPress themes? Read “Installing WordPress theme – Step by Step guide“
/**
* Change feed file generation interval
*/
add_filter( 'wc_facebook_feed_generation_interval', function(){ return 3600 * 24; } );
/**
I hope this resolved your issue. Please feel free to share what you have tried and what worked for you. Any improvement would be highly appreciated by the readers. and we might also implement that.