WordPress comes with a pseudo-Cron system for running various scheduled tasks. This mechanism works well on regular sites, but it is not suitable for sites like https://wenpai.org that need to run tens of thousands of tasks simultaneously and monitor task execution status.
Cavalcade was built to solve exactly this problem.
Cavalcade’s installation is not complicated, it consists of the Cavalcade mu-plugin and the standalone Cavalcade-Runner PHP component.
Installing the mu-plugin
Before installing Cavalcade, you first need to set up the WP-CLI environment on your system (skip this step if already installed).
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Next, add define( 'DISABLE_WP_CRON', true ); at the end of your wp-config.php file to disable WordPress’ built-in CRON mechanism so that Cavalcade can take over.
Next, download the Cavalcade repository and place it in the wp-content/mu-plugins/cavalcade directory, then create the wp-content/mu-plugins/cavalcade.php file with the following content to load Cavalcade.
require_once __DIR__ . '/cavalcade/plugin.php';
If everything works correctly (no errors in the admin dashboard) and you see new tables starting with wp_cavalcade_ in your database, you have completed half the installation and can proceed to install the Runner component.
Installing the Runner
Installing the Runner is relatively straightforward; simply download the repository and start it from your website directory.
/path/to/Cavalcade-Runner/bin/cavalcade
If the startup is successful with no error output, you can use nohup to run it in the background or use Supervisor to daemonize the process.
nohup startup command: run this from your website directory:
nohup /path/to/Cavalcade-Runner/bin/cavalcade > cavalcade.log &
Supervisor startup command: set the working directory to your website directory:
/path/to/Cavalcade-Runner/bin/cavalcade
Cavalcade has successfully executed millions of tasks for Wenpai Open Source so far, and is extremely reliable and stable.