Page Cache: WTF?
This article was automatically recovered from archived versions of this site via the Wayback Machine. It is likely outdated or contains formatting errors, as it has not been reviewed.

Page Cache: WTF?

July 25, 2012
drupalcache

Drupal currently flushes page cache on every CRON run. Eh? Looks like there’s a patch waiting in D7 to address this issue. I was quite surprised to find out about this behaviour over here while I was reasearching some other performance related things.

My primary reason to implement a cache warmer after reading this would be the fact that Google adds site loading time/performance as a qualiy factor in search, as we all know since a long time and as we all think impacts our pageranks - therefore we spend insane amount of time to optimise the backend. Ho ho ho - and then you figure this out. So, basically up until now, Google’s crawler was warming our cache, making the “expensive” first request on all of those nodes which aren’t usually visited that often. Read: 90% of your website. :)

Obviously requires you to have XML sitemap enabled, as it parses through the sitemap to find which pages to parse. .

It’s funny how the whole cache thing seems to be a little off with Drupal. I’ve encountered pages where the cache tables where full of stale entries which have - for the love of me - not been deleted, neither on CRON, manual “drush cc all” or anything. I had to purge the tables manually.

On the other hand, or at least according to the article linked above, the page cache is being emtpied on every CRON, no matter if an item’s TTL has been reached or not. Make sure you read the part about page cache lifetime set to 0 or an actual value and see how it is being handled kind of .. actually I don’t really get this part, because it just makes no sense to me. :)

This made me think about doing 2 things: Dropping default CRON for Elysia Cron and implementing a cache warmer on all pages running after system_cron() which is running early in the morning (once per day, more than enough). Additionally, tasks which need to be run a lot more frequently can be assigned different intervals. So if you run an Ubercart which should synch it’s MailChimp users every 5 minutes, you can do that and configure a custom interval for every CRON hook.

Personally, I just installed Elysia Cron on every site, made a default setup, manually configuring the most important hooks and then deploying the SQL config table of Elysia to all instances using a simple MySQL dump/reimport on local DB. Was pretty smooth, as D6 and D7 versions of this module use the same data format/table/rows and the important core cron hooks are called the same.