1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

the definitive APC tuning thread

Discussion in 'Server Configuration and Hosting' started by dieketzer, Nov 28, 2011.

  1. dieketzer

    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?


    ## 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';
  2. tenants

    tenants Well-Known Member

    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?
  3. Floris

    Floris Guest

    1200 is quite short .. I'd certainly consider raising the value
  4. dieketzer

    dieketzer Well-Known Member

    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.

    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.
  5. Floris

    Floris Guest

    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.
  6. dieketzer

    dieketzer Well-Known Member

    within 13 hours fragmentation is over 30%.
    i think i will try sessions=false plus ttl 7200 and see how that goes.
  7. Floris

    Floris Guest

    I use compressed js, minified css, templates in file system, APC to 128mb, and this in config.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';
  8. Floris

    Floris Guest

    Giving me this (uptime of 2+ days for apc)

    Screen shot 2011-11-29 at 9.30.37 AM.png
    Screen shot 2011-11-29 at 9.30.07 AM.png
    dieketzer likes this.
  9. dieketzer

    dieketzer Well-Known Member

    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?
  10. dieketzer

    dieketzer Well-Known Member

    restarted 8 minutes ago and already: Fragmentation: 0.01% ( 9.0 KBytes out of 106.6 MBytes in 11 fragments)
  11. dieketzer

    dieketzer Well-Known Member

    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.
  12. Claudio

    Claudio Well-Known Member

    which is the better config? you have indicated different values here:
  13. dieketzer

    dieketzer Well-Known Member

    the only thing he looks to have changed is the addition of sessions, which is a relatively new development of xf.
    and even if it were radically different, something like an apc config can be expected to change over time.
  14. Floris

    Floris Guest

    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.

Share This Page