Reduce memory used by the cron job and the time it takes to run

Symptoms

  • When you look at your Recent log entries, you are seeing the message Cron run exceeded the time limit and was aborted.
  • When you run the cron job manually(e.g. http://yoursite.com/cron.php), you are seeing the message Allowed memory size of ######## bytes exhausted (tried to allocate ####### bytes).

Solutions

For the sake of your tiny and low resource shared hosting webserver, change the following module's settings to reduce the memory used by the cron job and the time it takes to run:

Search
At admin/settings/search, lower the Number of items to index per cron run.
XML sitemap
At admin/settings/xmlsitemap, lower the Cron limit.
Boost
At admin/settings/performance/boost, lower the Number of URLs to grab at a time when loading up the crawler table.

It is always better for the cron job to do less work but often than doing all the work at once and getting aborted in mid way.

If you know other modules' settings that can affect the cron job, please comment so that I can expand this list.