How to make your website faster by using CRONTAB


The goal of this post is to enlighten you about the possible configuration to setup your cron and how to make your website faster by choosing the right cron setup.

WordPress uses WP-CRON default for the cron setup. However a big disappointment is that it only runs when the website has page requests. So for example if you need to run an event every hour, it's possible that it will not do that because no one will visit the website at 1am. It will probably run around 8am or something. So during those 8 hours cronjob events will not be processed and this can be a problem for some websites.

But did you know that WP-CRON is not the only option to setup your cron in WordPress?

Besides that WordPress also gives you an alternative by the name of ALTERNATE_WP_CRON. Most of the websites don’t use this (luckily) because it does add an extra parameter to the url and this isn’t a good case for the marketing department (SEO) plus it makes your website a lot slower.

Third option is that you can disable WP-CRON and use CRONTAB from your webserver.
A big plus is that it doesn’t need any page requests to process cron events. It works independently from the website and runs how it's supposed to run. If you want a cron event to run every hour then it will run that cron event every hour. Even at 1am!

To make a bigger point, I have tested these 3 options on my local environment with a clean WordPress installation without plugins and a default WordPress theme.
The cron event is a for-loop which will run 5 million times.

Test results

  • WP-CRON checks on every pageload if it needs to trigger wp-cron to process cron events. That check did add 1 second to the page load. The total pageload time was around 1.3s.
  • ALTERNATE_WP_CRON does process the cron events during the pageload which makes the pageload extra slow depending on your cron events. The total pageload time was around 10s.
  • By using CRONTAB, wp-cron will not run on pageload. It will work independently from the website. The total pageload time was around 0.3s!


As you can see, CRONTAB is by far the best option to use as your cron setup.
It will make your website faster (0.3s!) and it does run the cron events steadily. So there will be no issue that the event was not triggered because you didn't get any visitors.

Bampslaan 21 box 3.01
3500 Hasselt
VAT: BE08 4029 5063
2021 © AppSaloon All Rights Reserved
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram