A lot of high performance sites put the {cache} bin into shared memory (APC etc.) instead of memcache, because APC is faster than memcache, and having the cache bin local to the webserver saves sending big cache objects (variables etc.) across the network every request.

However, {cache} is a big dump of stuff from modules which are too lazy to make their own cache bin, and putting stuff into APC means that if you have have as many caches to maintain and rebuild as you do webheads - so a lot more cache misses.

So, this patch adds a {cache_bootstrap} table - to be used for things like variables, registry, module_implements(), entity info, locale cache which are required on every page request (and also happen to be fairly infrequently rebuilt). I'd originally thought of {cache_local} but Damien suggested cache_bootsrap in another issue, and that's more descriptive - although it's possible we'd want some things there which aren't technically required for a bootstrap.

Comments

catch’s picture

Title: Add a cache_boostrap bin » Add a cache_bootstrap bin
Status: Active » Needs review
StatusFileSize
new4.53 KB

Here's a start on a patch.

While rolling this, I noticed that we appear to have an entire cache_registry bin, which only holds a single cache entry, so we might want to remove that one too - since that cache entry will want to go in cache_bootstrap too.

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new10.7 KB

Removed cache_registry. Drupal installs locally for me now.

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Status: Needs work » Needs review

Incomplete find and replace, this should be a little better.

catch’s picture

StatusFileSize
new11.45 KB

grrr.

moshe weitzman’s picture

Priority: Normal » Critical
moshe weitzman’s picture

Priority: Critical » Normal

sorry - edited wrong issue.

dries’s picture

+++ includes/update.inc	9 Nov 2009 12:44:17 -0000
@@ -286,6 +286,10 @@ function update_fix_d7_requirements() {
+    $schema['cache_bootstrap']['description'] = 'Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.';

This one doesn't look correct to me.

Also, it would be good to capture the APC-trick in documentation somewhere. It doesn't have to be a long description, but a one or two sentence explanation would be great. Not instructions on how to set it up (that would live on drupal.org), but just a small description as why we store things in a separate bin.

catch’s picture

StatusFileSize
new11.39 KB

Not sure if it's enough of a hint, but put the APC information in the schema description.

dries’s picture

That is sufficient for me, but not necessarily great. Can't think of a better place to document this though. I'll commit this patch later today unless someone has a better suggestion.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

I don't have a better suggestion. There are a lot of high performance tips and we can't possibly doc them all in the code.

Patch looks good to me too.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Alright! Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

moshe weitzman’s picture

I am seeing a fatal error when a D7 site first loads update.php with a D6 DB. we try to query cache_bootstrap during the variables stage of bootstrap but the table does not exist yet. We need to either create that table even earlier or we need to use a FakeCache during update.php