Features

Optimise Action Scheduler

Published · Last updated

Action Scheduler is the background job system used by WooCommerce, WooCommerce Subscriptions and a lot of import plugins. It’s genuinely useful, but by default it holds on to its completed, failed and cancelled actions in its own tables for a long time. On a busy store those tables just keep growing. It’s not unusual to find millions of rows in there, and once they get that big they slow down not just Action Scheduler itself but the whole site, because those tables are queried constantly.

Did you know?

Action Scheduler stores every completed action by default, and on a busy WooCommerce store those tables routinely reach several million rows. Because those tables are queried on almost every request that schedules or claims a job, a bloated Action Scheduler slows the whole site, not just the background jobs.

The Optimize Action Scheduler option shortens the retention period so old actions are cleaned up sooner rather than lingering for months. Instead of letting completed and failed actions pile up indefinitely, they get cleared out on a shorter schedule, which keeps the tables at a sensible size and keeps the queries against them fast.

If your tables have already grown out of control, there are buttons on the same screen to deal with the backlog directly. You can empty the Action Scheduler tables and you can clear its logs, so you don’t have to wait for the shorter retention period to work through the existing pile.

Note

Emptying the tables clears the full history of completed and failed actions. Any actions still pending will re-queue as normal, but you lose the audit trail of what has already run, so use the empty buttons when you want a clean slate rather than as a routine.

You’ll find all of this in the Imports tab under “Optimize Action Scheduler”.

In short: Action Scheduler keeps old actions around far longer than most stores need, and on busy sites those tables grow into the millions of rows and slow everything down. This option shortens the retention period so old actions are cleaned up sooner, with buttons to empty the tables and clear the logs when you need to clear a backlog straight away.

Further reading

fix a slow query in another job Action Scheduler drives
the biggest single import speed win on a large catalogue
tackle the other table that quietly bloats and slows every request

Comments

▲
▼
1/1