[drupal-devel] Menu cache
Dries Buytaert
dries at buytaert.net
Tue May 10 08:52:22 UTC 2005
We found that on drupal.org, the SQL query to load the menu cache
sometimes takes 50 ms or more to complete (normally, a query takes 0.3
ms to complete):
mysql> SELECT data, created, headers, expire FROM cache WHERE cid =
'menu:<uid>:en'
Further investigation showed that these rows are _big_. If we look at
the size of chx's menu cache, we see that it is 120 KB even though we
have a fairly simple menu on drupal.org! The largest menu cache is 180
KB, the smallest menu cache is 67 KB. If we look at the total size of
the menu cache, we see that we host more than 36 MB worth of menu
caches (= the menu cache of 483 users). I'm sure there are times we
keep more than 483 users' cache ...
mysql> SELECT LENGTH(data) FROM cache WHERE cid = 'menu:9446:en';
mysql> SELECT SUM(LENGTH(data)) FROM cache WHERE cid LIKE 'menu:%';
I know we benchmarked this extensively at the time we committed the
menu cache patch (though only on a single user setup). Nonetheless, it
is worth investigating/revisiting. Maybe we are caching too much, or
maybe it is worth compressing the cache by using shorter variable names
in the $_menu-array, or ... ?
--
Dries Buytaert :: http://www.buytaert.net/
More information about the drupal-devel
mailing list