WooCommerce Subscriptions at Scale

At Universal Yums we process a large amount of subscription renewals on the 1st of every month. We generally process at a rate of ~10k-20k renewals per hour until all the renewal are complete. If you’re looking to run a WooCommerce Subscriptions site at scale, here’s some tips.

Optimize Your Hosting Plan

We host with WP Engine on an enterprise plan (P4 APM). The cost, which includes New Relic, extra storage, and a dedicated staging environment is nearly $4k/mo. If you’re running a large subscription business, it’s important to invest in good hosting. You’ll want to be on a plan where CPU usage is at a comfortable level even on the big renewal days.

Increase Action Scheduler Throughput

Subscription renewals are processed via the Action Scheduler. To process more renewals at a time, you’ll want to increase batch size, concurrency, timeout period for scheduled actions. Please note, you’ll want to tune this appropriately for the amount of server resources you have.

Here’s a gist with code showing how to increase all these limits.

Run Batches via WP CLI

If you have ssh access to your server and WP CLI installed, you can run your scheduled actions directly with a WP CLI command. The command to process scheduled renewal actions looks like this:

wp action-scheduler run --batch-size=50 --batches=100 --hooks=woocommerce_scheduled_subscription_payment

We have a scheduled cron job on a different server (hosted with Laravel Forge) which runs every 5 minutes on the first the month to run these batches. This helps us process the subscription renewals much quicker. Here’s an example showing what that cron job looks like:

ssh -i /home/forge/.ssh/serverkey_rsa wp_server@wp_server.ssh.wpengine.net wp action-scheduler run --batch-size=50 --batches=100 --hooks=woocommerce_scheduled_subscription_payment >>/home/forge/cron-logs/renewals-action.log 2>>/home/forge/cron-logs/renewals-error.log

You can see this also logs the output in case it needs to be inspected later.

Optimize Your Action Scheduler Tables

Renewals run noticeably slower when our actionscheduler_actions table is really full. It’s helpful to clear out completed or failed actions if you no longer need those records.

Optimize Your Queries

Having a tool like New Relic installed is really helpful for tracing down slow queries. You can also use a tool like Query Monitor.

Avoid Unnecessary Database Writes

By default WooCommerce Subscriptions transfers over all order meta data to the subscription, and then to each renewal order. If there’s any data you don’t need transferred to every renewal, you should prevent it from copying over. Here’s a previous article I wrote on this subject with code snippets and instructions.


It is possible to run a high scale WooCommerce Subscriptions site if you optimize for it! Please share any other tips or war stories in the comments.

2 Responses

  1. shalom, and thanks for the post.
    what you would say about a site with 15000 subscriptions per month that are triguered in different days?
    should i need a so heavy hosting?

Leave a Reply