the definitive APC tuning thread

dieketzer

Well-known member
ok, maybe it isnt yet. but hopefully this thread can become such a thing.
like many others i am sure, apc is working, it just needs a bit of tuning.
look at this pic and what does it say to you?

apc-nov-2011.webp

config.php
Code:
## Caching
#  http://xenforo.com/community/threads/speed-up-your-board-caching.5699/
#  http://xenforo.com/community/threads/tip-use-apc.6456/
$config['cache']['cacheSessions'] = true;
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
                                        'caching'                      => true,
                                        'automatic_serialization'      => true,
                                        'lifetime'                      => 1200,
                                        'cache_id_prefix' => 'foro'
);
$config['cache']['backend'] = 'Apc';
 
That your host has only been up for 20 hours ? ;)

I don't know, I haven't looked at server stats like this before, will try tonight

You have 9.2 MBytes of cached variables (+~52Mbytes for cached files, this totals 61ish), and a total of 61.5 MBytes of Memory usage (that's good isn't it?)

What does the hits and misses represent?
 
That your host has only been up for 20 hours ? ;)

I don't know, I haven't looked at server stats like this before, will try tonight

You have 9.2 MBytes of cached variables (+~52Mbytes for cached files, this totals 61ish), and a total of 61.5 MBytes of Memory usage (that's good isn't it?)

What does the hits and misses represent?
the way i understand it, hits are requests for things that have been cached, while misses are requests for things that have not been cached.

1200 is quite short .. I'd certainly consider raising the value
i will be the first to admit that i am not super knowledgeable with caching. i used to have it set to 7200, but lowered it to 1200 to hopefully combat fragmentation. google research came up with that advise. im not certain how it holds up in the real world.
after taking that screendump i restarted and 2.75 hours later i am already up to 4% fragmentation.
 
If you read something, cache it, and it expires before the next user has option to read the cache .. it's kinda useless.
I keep it as simple as that.

Very big web sites benefit from fighting fragmentation perhaps via short life caching, they will otherwise fill up their memory as way way way more individual pages are called.

Small to starting to become big web sites benefit from having the cache there a bit longer, as the spread of traffic is also quite a bit less.
 
within 13 hours fragmentation is over 30%.
i think i will try sessions=false plus ttl 7200 and see how that goes.
 
I use compressed js, minified css, templates in file system, APC to 128mb, and this in config.php

PHP:
$config['cache']['enabled'] = true; // from 1.0 beta 3 onwards
$config['cache']['cacheSessions'] = true; // from 1.1 beta 4 onwards
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
										'caching'                      => true,
										'automatic_serialization'      => true,
										'lifetime'                      => 10800,
										'cache_id_prefix' => 'xenfans_' // Make unique per site
);
$config['cache']['backend'] = 'Apc';
 
i have thrown 128 at apc, raised the ttls to 10800, and have pretty much copy and pasted your cfg.
im not sure how well that will go. gv is a lot larger than xenfans. perhaps if i encounter cache full issues i will set sessions=false and whatnot.
i recall kier saying that he had nothing at all in the config. is that still the case you reckon? or is enabled=true the new minimum?
 
restarted 8 minutes ago and already: Fragmentation: 0.01% ( 9.0 KBytes out of 106.6 MBytes in 11 fragments)
 
removed all cache stuff from the cfg except enabled=true, and 10 minutes later there is zero fragmentation.
i might give it 12 hours and see what develops. if there is still no fragmentation i may add more back to the cfg. id like to find out where exactly the fragmentation comes into play.
 
I use compressed js, minified css, templates in file system, APC to 128mb, and this in config.php

PHP:
$config['cache']['enabled'] = true; // from 1.0 beta 3 onwards
$config['cache']['cacheSessions'] = true; // from 1.1 beta 4 onwards
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
'caching'                      => true,
'automatic_serialization'      => true,
'lifetime'                      => 10800,
'cache_id_prefix' => 'xenfans_' // Make unique per site
);
$config['cache']['backend'] = 'Apc';
which is the better config? you have indicated different values here:
http://xenfans.com/threads/tip-use-apc.94/
 
which is the better config? you have indicated different values here:
http://xenfans.com/threads/tip-use-apc.94/
Those were the values at that point, the above is how I currently run it.
Nothing changed, except the session caching since 1.1's introduction of it.
And I used to have 32mb for apc, now it's 128m (huge improvement)

I now also store templates in the file system, use minified css, and compressed js.
With a tiny bug in the beta of 1.1 I didn't host .js remotely, but will soon again.
 
Top Bottom