I'm exploring options around keeping my Drupal 7 sites working for anonymous visitors while a database server is being upgraded. The site is already fronted by Cloudflare - but their always on tech is a little hit and miss.

I'd like to understand more about when the database is queried when using the memcache module. My other choice is to use the AutoSlave module and setup a master - slave replication - but if I can get a performance boost from memcache and a little resilience added in - I'd maybe prefer that route.

I'm hoping that the page cache will remain relevant enough to perform the database upgrade. What are the rules around the memcache content going stale?

  • I think trying to do this with Memcache would be a waste of time. You should be looking at Varnish and doing it and the Apache / Nginx level. Or perhaps set up a duplicate of your DB on a different server and let your site use that during the upgrade. That way, Memcache would help reduce load on it. Commented Nov 16, 2017 at 12:19

1 Answer 1


As stated in the comments, memcache is probably not going to help you here.

Since you are using CF as a front end, you might be able to get by by creating a page rule to cache everything. See this doc. This assumes that your site is pretty static (e.g. not an e-commerce or has user logins.

I'd suggest creating a script to load all your pages prior to shutting down the sql server. I.e., clear the CF cache then load all the pages into cache using the script. A bunch of CURL statements should work. Make sure to load ALL the content (e.g. images, css, scripts).

That said, I really would not depend on this. Personally, I'd set up a temporary DB server, copy the DB to it, then change the settings.php to point to it when the main DB is being updated. Then swap it back after the update.

  • thanks for that - good insight. I'll post a further question around how to use a backup database using a module such as Auto Slave - but only for temporary use - e.g. during Main server upgrades or planned outage. Commented Nov 17, 2017 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.