Resource Usage: memory overload caused by Wordpress cron

Modified on Tue, Nov 16, 2021 at 9:42 PM

Every time visitor access your Wordpress website, wp_cron.php file fires up. If you have few visitors per second, it won't cause any issues. However, if 100 people land on your main page at once, your site will consume a lot of memory (at least 4GB) and CPU.

To prevent unnecessary memory consumption, we do recommend to use Cron built in cPanel. Here is how:

1. Backup following file: wp-config.php then make sure that file has 600 permissions (644 shouldn't be used).

2. Open wp-config.php file either via cPanel file manager or any editor within FTP client (Filezilla). We're using Filezilla with simple Notepad editor.

3. Find following lines inside wp-config.php file:


*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */


4. Add one line immediately after "WP_DEBUG line" line so it will look exactly like so: 


*/
define('WP_DEBUG', false);
define('DISABLE_WP_CRON', true);
/* That's all, stop editing! Happy blogging. */


5. Go back to cPanel then search for "cron". We do recommend to process cron jobs TWO times per day. DO NOT set it "every 5 minutes", "every 30 minutes" etc., it will overload your website!

Add following Cron Job (process every day or two times per day)

/usr/bin/wget -O /dev/null https://www.yourdomainhere/wp-cron.php?doing_wp_cron


That's it!

If you experience any issues right after wp-config.php modification (error 500 etc.), please restore wp-config.php from backup then complete this tutorial again.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article