Cron jobs are a fundamental part of server management and running WordPress. In this article, we’ll explore how LaunchWP Cron is a revamped version of the default WordPress Cron that runs on the Server level and allows Parallel Processing of tasks within WordPress Cron Jobs.
Table of Contents
Introduction
Let’s define each term one by one. Firstly, let’s see what Cron Jobs are. Cron jobs are scheduled tasks that run automatically on Unix-like operating systems at predefined intervals. They are used for various purposes, such as data backups, system maintenance, and regular script execution. Cron jobs save time and effort by automating repetitive tasks.
Now, WordPress core and many plugins need a scheduling system to perform time-based tasks. WordPress uses something called WP-Cron. By default, WordPress doesn’t use the native server-level cron, instead, WP-Cron works by checking, on every page load, a list of scheduled tasks to see what needs to be run. Any tasks due to run will be called during that page load. This is done as many hosting services are shared and do not provide access to the system scheduler.
Issues with default WP-Cron
This default on-page-load WordPress cron has a lot of issues. As events are run on page load, that means it can essentially slow down page loads because of scheduled tasks being processed. Also, if your website hasn’t had any visitors in a while, it will mean that your scheduled tasks will never run. This unreliable system of running Cron Jobs is solved when WordPress Cron jobs are handled by the Server itself.
Say hello to LaunchWP Cron
In LaunchWP, the default on-page load model, WordPress Cron, is disabled. Instead, LaunchWP uses a more robust and reliable method for running cron. It uses Automattic’s Cron Control runner to process cron jobs, the same one used for WordPress VIP sites. It gives a LOT of advantages over default WP Cron, as well as over normal Server Level Cron. Some of the advantages you will enjoy while using LaunchWP’s Cron System are:
- WP-Cron jobs are saved custom cron table for better events storage, instead of the default storage of the cron option in wp_options
- The default WordPress core cron only runs 1 cron task at a time. This means by default WordPress is only able to handle running only one cron job at a time. It keeps additional jobs pending while 1 cron task is running. This makes it overly unreliable for mission-critical cron jobs. LaunchWP Cron can process multiple events in parallel, with custom event storage for high-volume cron. This now means multiple Cron Jobs tasks can run on LaunchWP cron, at the same time, without affecting other WordPress operations.
- Default WordPress Cron Jobs are ran on page-load, whereas LaunchWP Cron jobs are run once every 20 seconds. This means, even if your WordPress has any activity or not, your Cron Jobs are almost guarentied to run.
LaunchWP Cron sets up a custom cron table for better event storage. Using WP hooks, it then intercepts cron registration/retrieval/deletion. There are two additional interaction layers exposed by the plugin – WP-CLI and the REST API. The Cron Runner is handled by a Go-based application, which runs the Cron Tasks in the backend, without affecting normal WordPress operations.
Get Started with LaunchWP Cron
LaunchWP Cron is by default configured on every LaunchWP-powered WordPress website. LaunchWP uses its helper plugin: https://wordpress.org/plugins/launchwp/. Make sure your LaunchWP-powered WordPress website has this Helper plugin activated for LaunchWP Cron to function properly. To verify if your LaunchWP-powered website is running on LaunchWP Cron, please follow the steps below:-
- Install the plugin WP Crontrol.
- After the plugin is activated, navigate under Tools > Cron Events.
- You shall see a Text like “WP-Cron spawning is being managed by the Cron Control plugin.”
- This would mean that WP-Cron is successfully being run by LaunchWP Cron.
And that would be it! Your LaunchWP-powered WordPress website should have a robust cron system capable of running high-velocity cron tasks in parallel, without affecting WordPress activities. If you face any issues, feel free to get in touch, and we would be more than happy to assist. If you are new to LaunchWP, sign up for a Free Trial today (No Credit Card needed).