Native Linux Cron
WordPress has a scheduler that allows processes to run on a periodic basis. However this scheduler has two fatal flaws:
- It only runs when there is activity on the site. This means that if a process is scheduled to run at 1:00 pm but no activity has occurred around that time-frame, the process will not run until someone uses the site.
- Because it runs every time there is activity on the site, it uses up resources on every request for a page/post/object. For sites with a lot of simultaneous users or heavy activity, it’s a lot of unnecessary overhead.
However, there is a way to make sure that WordPress runs scheduled tasks without missing them and without unnecessary overhead. It involves setting up a native Linux Cron (“cron” is the Linux scheduler.)
To enable this:
- Go to WPCloudDeploy->All Apps (or WPCloudDeploy-> WordPress Sites)
- Click on the site for which you need an SSL certificate
- Click on the Crons tab
- Select an interval – this is how often the native Linux cron will force WordPress to check to see if scheduled tasks need to be run. The lower the interval the more load on the site. But, some sites do need a 1 minute interval so it’s available as an option – if yours do, then choose that. Otherwise choose 15 mins or 60 mins.
- Click on the toggle switch and then click the OK button on the confirmation message
When you activate CRONs on a multisite installation of WordPress, the cron process will loop through and trigger on each sub-site. If you set your interval to 1 minute then you’ll be doing this every minute, causing a ton of load on your installation. Think very carefully about activating a native cron on a Multisite installation of WordPress. And, if you do decide that it is appropriate, whether you can use a larger interval such as 15 or 60 minutes. The more sub-sites you have, the more critical this decision will be for performance.