[development] Object caching
George Kappel
gkappel at herrspacific.com
Thu Jul 20 23:34:56 UTC 2006
Working on a development server 1GB RAM, Mysql caching turned on performance
was poor with 1 user
With the following change performance was hugely improved, I guess it is
possible that something is wrong
With the mysql setup but it seems to work very fast except for huge blob
data.
For this site the menu does not change
function menu_get_menu()
/*
if ($cached = cache_get($cid)) {
$_menu = unserialize($cached->data);
}
else {
_menu_build();
// Cache the menu structure for this user, to expire after one day.
cache_set($cid, serialize($_menu), time() + (60 * 60 * 24));
}
*/
if ($_menu = apc_fetch($cid)) {
//loaded menu from cache
} else {
_menu_build();
apc_store($cid,$_menu,36000);
}
>
> Do you have any figures showing the improvement from this
> change? I benchmarked APC a while ago (v3.0.8) and couldn't
> manage to show a significant performance increase.
>
> Data stored in APC is also serialized and unserialized.
> You're only saving the database call and with a busy site
> and a well-tuned database this result should be served
> from RAM.
>
> Not to mention, you still need to build the menu when
> it changes and that's where the real overhead occurs.
>
> ...R.
>
More information about the development
mailing list