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

Installed APC ...how do I know if it's working?

Discussion in 'Server Configuration and Hosting' started by daviden, Apr 17, 2013.

  1. daviden

    daviden Active Member

    I added this to my config.php:

    PHP:
    ## Caching
    #  http://xenforo.com/community/threads/speed-up-your-board-caching.5699/
    #  http://xenforo.com/community/threads/tip-use-apc.6456/
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array(
                                            
    'caching'                      => true,
                                            
    'automatic_serialization'      => true,
                                            
    'lifetime'                      => 10800,
                                            
    'cache_id_prefix' => 'xf'
    );
    $config['cache']['backend'] = 'Apc';
    I can access the test apc.php that I uploaded, and I see this:
    Skärmavbild 2013-04-18 kl. 00.11.46.png

    Short question ...is my APC working?
     
  2. MattW

    MattW Well-Known Member

    Click the System Cache Entries or User Cache Entries and see if there is anything in there relating to your forum.
     
    daviden and CyclingTribe like this.
  3. daviden

    daviden Active Member

    System Cache Entries is filled with (forum) stuff, User Cache Entries is empty.
     
  4. MattW

    MattW Well-Known Member

    Try sticking an option in your config to cache the sessions. That will store them in APC and you'll see them in User Cache Entries

    PHP:
    $config['cache']['cacheSessions'] = true;
     
  5. daviden

    daviden Active Member

    Looks like this now:
    PHP:
    ## Caching
    #  http://xenforo.com/community/threads/speed-up-your-board-caching.5699/
    #  http://xenforo.com/community/threads/tip-use-apc.6456/
    $config['cache']['frontend'] = 'Core';
    $config['cache']['cacheSessions'] = true;
    $config['cache']['frontendOptions'] = array(
                                            
    'caching'                      => true,
                                            
    'automatic_serialization'      => true,
                                            
    'lifetime'                      => 10800,
                                            
    'cache_id_prefix' => 'xf_'
    );
    $config['cache']['backend'] = 'Apc';
    No data yet though...
    There's 80 members active right now, so it should generate something if it'd worked, right?
     
  6. MattW

    MattW Well-Known Member

    Yeah, it would work instantly.

    Here is from my dev site with only me on there
    apc_cache.PNG
     
  7. daviden

    daviden Active Member

    Hm;

    /http://xenforo.com/help/cache/

    Should I remove that again maybe?
     
  8. daviden

    daviden Active Member

    Is it because I'm running an older version? Installing with Pecl failed when it tried to compile...
    Code:
    /usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
    compilation terminated.
    make: *** [apc.lo] Error 1
    ERROR: `make' failed
     
  9. MattW

    MattW Well-Known Member

    Depends if you want to store the sessions in APC as well. You can adjust a few settings in APC to prevent fragmentation which is caused by having the sessions stored in there.
     
  10. daviden

    daviden Active Member

    What do you recommend? And how do I configure what you recommend? :p I'm totally new at this...
     
  11. MattW

    MattW Well-Known Member

    lol :)

    In your APC settings, you need to increase the apc.user_ttl setting. When I ran APC, I had it set to 86400

    Code:
    apc.ttl = 86400
    apc.user_ttl = 86400
     
  12. CyclingTribe

    CyclingTribe Well-Known Member

    Yes. (y)

    Clearing the cache clears all your members login sessions, requiring them to log back in again - which is no fun for your regulars (and if you're using Apache this will be every day when it rotates the logs [unless you've set-up piped logging] ... :eek: ).

    You're also unlikely to see any noticable speed difference by caching sessions in APC.
     
    daviden likes this.
  13. daviden

    daviden Active Member

    Ok... Managed to update APC to latest version now too.
    Added apc.so to php.ini ...and visited my page - BLANK!

    ...forgot to restart apache, working now. Phew...

    So... I should just be happy about caching the stuff I'm caching now?
     
  14. MattW

    MattW Well-Known Member

    It will be caching the compiled PHP scripts by default, which is where most of the speed improvement will come from.
     
  15. daviden

    daviden Active Member

    Ok.
    I did not change anything in APC settings ...do I have to do that?
    I'm happy with the caching of php scripts.
     
  16. MattW

    MattW Well-Known Member

    What are your current APC settings? There might be a few things you can tweak to make it more stable in the long run (such as the apc.shm_size )
     
    daviden likes this.
  17. CyclingTribe

    CyclingTribe Well-Known Member

    You could, if you don't have it already, install an object cache like memcached/Libmemcached - you can use this for sessions and other non-compiled content as it's a persistant object cache (APC is an opcode [compiled code] cache).
     
    daviden likes this.
  18. daviden

    daviden Active Member

    I haven't changed anything ...I just installed it. To be honest, I don't even know where to change the settings.

    Do you think it's a good idea? Is it hard to setup...? Remember, I'm a total newbie on this stuff. Not stupid, but newbie. :)

    It's late here (in Sweden) and I'm going to bed, work tomorrow ...but I'll be back tomorrow and read the tip you'll (hopefully) give me.
    BIG thanks so far. :)
     
  19. MattW

    MattW Well-Known Member

    Are you running cPanel?

    Usually, your APC settings are in your php.ini file.
     
  20. daviden

    daviden Active Member

    Nope, doing all the stuff in console.
     

Share This Page