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

XenForo + caching = AMAZING

Discussion in 'Server Configuration and Hosting' started by Coop1979, Jun 11, 2012.

  1. Coop1979

    Coop1979 Well-Known Member

    Tomorrow will mark my 2 week anniversary of migrating our 1.5 million posts from vBulletin to XenForo, and I wanted to start sharing a little bit of data from our experience so far.

    One thing I was looking forward to was increased performance, and XF definitely delivered. With APC and Memcache installed on vBulletin, we were seeing maybe 50-60% hits in Memcache. Now the numbers for both APC and Memcache are 100%.

    Screen shot 2012-06-11 at 4.24.27 PM.png Screen shot 2012-06-11 at 4.24.09 PM.png

    With over 900 people on the site right now, our database server is barely flinching, with load averages hovering around 0.08. That is down from between 3.00-7.00 or higher on vBulletin.

    The efficiency with which XF operates is nothing short of amazing.

    While overall page views are down due to XF cutting out a lot of un-necessary pages that vB would direct users to, Unique Visitors is up over 25% since our switch-over.
  2. robdog

    robdog Well-Known Member

    Yes, memcache + APC = awesomeness. Oh and it looks like you can drop the memory setting on your APC server. After 2 weeks it doesn't appear to be going over 190MB. I believe you have it set for 512MB ever thought about lower it to 256MB?
  3. DRE

    DRE Well-Known Member

    So all you did to achieve this was have both those caching features installed on your server and adding it to your config file as listed here? http://xenforo.com/help/cache/
  4. Will

    Will Active Member

    Yes, that is all you need to do.
    Coop1979 and 8thos like this.
  5. MrC

    MrC Active Member

    How did you display memcached information in a graph like that?

  6. ragtek

    ragtek Guest

    Inside the memcache package you'll find a memcache.php file.

    You need to set the configuration inside of the file
    define('ADMIN_USERNAME','memcache');// Admin Username
    define('ADMIN_PASSWORD','password');  // Admin Password
    define('DATE_FORMAT','Y/m/d H:i:s');
    $MEMCACHE_SERVERS[] = 'mymemcache-server1:11211'// add more as an array
    $MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'// add more as an array
    upload it to you webroot and call it in the browser

    Another nice implemetion is http://code.google.com/p/phpmemcacheadmin/
  7. MrC

    MrC Active Member

    Thanks ragtek, it's so much like apc.php. memcache.php shows 0.1% misses here, quite good.
  8. ragtek

    ragtek Guest

    MrC likes this.
  9. DRE

    DRE Well-Known Member

  10. Hackfall

    Hackfall Member

    I'm just setting up my first Xenforo server on a VPS. Thanks to a suggestion from p4guru I used Centmin Mod to install nginx/php-fpm/mariadb(mysql). This automatically installs Memcache and Xcache rather than APC.

    Having read this thread I'm wondering if I should rip out Xcache and install APC. I'd be interested to hear words of encouragement or discouragement.

    It seems to me that I might as well get the whole thing tuned up as best I can at this stage.
  11. p4guru

    p4guru Well-Known Member

    from centmin mod you can install apc instead of xcache via menu options - it's option #9 on the menu when you re-run centmin.sh. Before installing APC, edit /usr/local/lib/php.ini manually or via centmin mod shortcut and remove the xcache.so and xcache related lines and save php.ini and restart php-fpm. Then run option #9 from centmin.sh run to automatically install APC cache, you can then edit php.ini to adjust memory allocation to APC
    Hackfall likes this.
  12. Hackfall

    Hackfall Member

    @p4guru Thanks for the tip, that went super easy. The only slight snag was the script suggested by centmin:

    python /usr/local/nginx/conf/htpasswd.py -b /usr/local/nginx/conf/htpasswd yourusername yourpassword
    Kept returning unsupported hash type errors however it appears to have worked anyway. ie there's an encrypted password and my username stored in the htpasswd file and these work when I visit 9919_myapc.php to look at my cache usage data and pie charts.

    I now feel like I've got the best possible server set-up for a small VPS. Centmin makes doing this very easy. Thanks again.
  13. Adam Howard

    Adam Howard Well-Known Member

    Just a side note for those who read this thread, but may not have enough ram or are using shared hosting

    File Cache
    config.php --- Remember to change the PATH (full server path)

    $config['cache']['enabled'] = true;
    $config['cache']['cacheSessions'] = true;
    $config['cache']['backend'] = 'File';
    $config['cache']['backendOptions'] ['cache_dir'] = '/path/to/cache';
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] ['cache_id_prefix'] = 'xf_';
    You'll also may want or need to change the prefix if you have more than 1 forum (test forum for example).

    When moving your site to either a different directory or server or domain name... You'll want to delete your cache folder and make a new one (system will automatically generate new cache). Before or without doing this, things will not work.
    otto, quydo and Sadik B like this.
  14. aculate

    aculate Well-Known Member

    very encouraging!!!
  15. D.O.A.

    D.O.A. Well-Known Member

    nginx, php-fpm, APC - I've watched htop and we are using just on 2GB out of 8GB for 1200 members + 8000 guests online viewing 40,000 image attachments and our videos.
    The above was peak load for me so far, when some new video hit the scene. Anyway, it's all good. APC kicks ass.

    CyclingTribe likes this.
  16. Chris D

    Chris D XenForo Developer Staff Member

    Can someone clarify for me, please, regarding using XenForo with both memcache and APC?

    How do you define both in the config file?

    $config['cache']['backend'] = 'Apc';
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
    'compression' => false,
    'servers' => array(
    // your memcached server IP /address
    'host' => 'localhost',
    // memcached port
    'port' => 11211,
  17. MrC

    MrC Active Member

    I am using this:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array(
    'caching'                  => true,
    'automatic_serialization'  => true,
    'lifetime'                  => 1800,
    'cache_id_prefix'          => 'xf2_'
    'servers' => array(
    $config['cache']['cacheSessions'] = true;
  18. Chris D

    Chris D XenForo Developer Staff Member

    Yeah we've got that - but I'm hearing that there's benefits to having both APC and Memcached installed - which we have. What's the correct configuration for that?
  19. MrC

    MrC Active Member

    I think Xenforo will use APC opcode as long as we have it installed (no need to put it in the config file)?
    btfstone and CyclingTribe like this.
  20. MattW

    MattW Well-Known Member

    Correct. I've set up APC over the weekend, and it's caching all PHP pages on my server (including Opencart, phpBB3, Wordpress and Xenforo).
    kombi and MrC like this.

Share This Page