Add a cache_bootstrap bin

catch - November 9, 2009 - 04:24
Project:Drupal
Version:7.x-dev
Component:base system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:Performance
Description

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.

#1

catch - November 9, 2009 - 07:06
Title:Add a cache_boostrap bin» Add a cache_bootstrap bin
Status:active» needs review

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.

AttachmentSizeStatusTest resultOperations
cache_bootstrap.patch4.53 KBIdleFailed: Failed to install HEAD.View details | Re-test

#2

System Message - November 9, 2009 - 07:15
Status:needs review» needs work

The last submitted patch failed testing.

#3

catch - November 9, 2009 - 07:22
Status:needs work» needs review

Removed cache_registry. Drupal installs locally for me now.

AttachmentSizeStatusTest resultOperations
cache_bootstrap.patch10.7 KBIdleFailed: 11770 passes, 2277 fails, 1045 exceptionsView details | Re-test

#4

System Message - November 9, 2009 - 07:40
Status:needs review» needs work

The last submitted patch failed testing.

#5

catch - November 9, 2009 - 12:45
Status:needs work» needs review

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

#6

catch - November 9, 2009 - 12:45

grrr.

AttachmentSizeStatusTest resultOperations
cache_bootstrap.patch11.45 KBIdlePassed: 14678 passes, 0 fails, 0 exceptionsView details | Re-test

#7

moshe weitzman - November 10, 2009 - 05:06
Priority:normal» critical

#8

moshe weitzman - November 10, 2009 - 05:07
Priority:critical» normal

sorry - edited wrong issue.

#9

Dries - November 10, 2009 - 07:35

+++ 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.

#10

catch - November 10, 2009 - 08:47

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

AttachmentSizeStatusTest resultOperations
cache_bootstrap.patch11.39 KBIdlePassed: 14707 passes, 0 fails, 0 exceptionsView details | Re-test

#11

Dries - November 10, 2009 - 16:48

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.

#12

moshe weitzman - November 10, 2009 - 18:05
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.

#13

Dries - November 10, 2009 - 22:06
Status:reviewed & tested by the community» fixed

Alright! Committed to CVS HEAD. Thanks.

#14

System Message - November 24, 2009 - 22:10
Status:fixed» closed

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

#15

moshe weitzman - December 7, 2009 - 05:03

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

 
 

Drupal is a registered trademark of Dries Buytaert.