You open Tools, Scheduled Actions, and the past-due list is longer than it was last week. So someone raises the Action Scheduler batch size, the queue burns through more actions per run, the screen looks healthy again, and a few days later checkout drags every time the queue is busy. Nothing failed. The queue got faster and the store got slower at the same time, and both screens are telling the truth.
The framing comes from a piece on Towards Data Science by Arjun Kaarat, which argues that a delivery route’s cost-per-stop keeps improving well past the point where the last customer on the route starts eating every delay accumulated ahead of them. I read it and kept recognizing the WooCommerce queue.
The Action Scheduler batch size tradeoff
Action Scheduler claims 25 actions per batch by default and gives the runner 30 seconds, per its own performance docs. Claiming has overhead, so a bigger claim grabs more actions at once, and the throughput number improves the moment you turn the dial up. But a batch runs inside one PHP request. If action 3 is a payment webhook that hangs for eight seconds, actions 4 through 25 wait behind it, and if the batch runs out of its 30 seconds, everything still claimed sits there until the claim is released. The last action in the batch is the last stop on the route: it inherits every delay ahead of it, the same way the article’s last customer inherits a slow elevator three stops back.
The other half is where the cost lands. The queue is triggered by WP-Cron and by the shutdown hook on admin requests, so queue work runs on the same PHP-FPM workers your shoppers use, and concurrency is capped at 1 batch by default for exactly that reason. Raise the batch size on a small host and you’ve moved cost off the past-due metric and onto time to first byte during runs. The article opens with Braess’s paradox, a road that works correctly and still slows the network, and a cron entry firing the queue every minute is the same shape. (I’m less sure how this plays out on hosts that serialize PHP requests instead of running them side by side.)
What I’d change first
Measure before you change anything. Watch Scheduled Actions during a normal run and check the store’s response time while it runs. If past-due climbs while the admin feels fine, you’re already past the divergence point, and a bigger batch makes it worse. If past-due is flat and actions run fast, you have room.
Then split the two workloads, the same batch or stream call you’d make for any heavy job. Keep web-triggered runs small, and clear real backlogs from a server cron where the queue doesn’t share a request with a customer:
<?php
function bbioon_as_web_batch( $batch ) {
if ( defined( 'WP_CLI' ) && WP_CLI ) {
return $batch; // the CLI flag controls it there.
}
// Web runs share PHP workers with shoppers, so keep claims small.
return 10;
}
add_filter( 'action_scheduler_queue_runner_batch_size', 'bbioon_as_web_batch' );
On the server, wp action-scheduler run --batch-size=50 --batches=0 from a cron job clears a backlog in one sitting, and the WP-CLI docs cover the flags. I’d keep --force out of cron entries. It overrides the concurrency cap, and that cap is what protects your PHP workers.
If you’re not sure which side of the line your store sits on, this is the kind of thing I look at during maintenance work. Reading the past-due pattern against the server logs usually settles the batch size question in about an hour.
The other side has a real point. The docs say plainly that if your actions run in milliseconds, a larger batch is a legitimate win because you claim less often. The Action Scheduler team made the same tradeoff in 4.0: they moved table cleanup off the batch path into a daily 3 am task that deletes at least 250 rows per run, because inline cleanup kept falling behind on high-volume stores. The core team batches too. They just put it where it doesn’t share a request with anyone.
Skip all of this if your actions are tiny and fast: raise the batch and move on. And if you’re on shared hosting with no shell access, don’t start with the queue. Replace WP-Cron with a real cron job first, because half the time a growing past-due list is a cron problem.