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

XF 1.2 Caching question

Discussion in 'XenForo Questions and Support' started by vexx, Mar 6, 2014.

  1. vexx

    vexx Active Member

    Hey guys,

    Wondering about XF's caching..I plan to use Memcache ..my question is, should I config memcache to be the only caching system or should I combine it with "cache front-end" as shown in the documentation. I'm not sure what's the best route.

    Maybe someone did a caching thread, but I couldn't find it via search.

    Thanks!
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Both frontend and backend are required.
    The frontend enables the cache.
    The backend defines the type.
     
  3. vexx

    vexx Active Member

    Ah got it, so just to double check, this is enough in config.php?

    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';

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

    // memcached port
    'port' => 11222,
    )
    )
    );
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    See this document:

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

    In all, to use Memcached for XF's cached data you need to add this code to the library/config.php file:

    Code:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
    	'compression' => false,
    	'servers' => array(
    		array(
    			// your memcached server IP /address
    			'host' => 'localhost',
    			
    			// memcached port
    			'port' => 11211,
    		)
    	)
    );
    
    A memory cache (such as Memcached) can speed things up. But be sure to monitor the cache. An unhealthy memory cache can actually be a detriment. A memory cache is really only appropriate for large / busy forums on a dedicated server with a server admin to configure it.

    Besides a memory cache, using an opcode cache like APC is a benefit to all forums and will speed up execution by way of having it installed on the server without any configuration in XF itself.
     
  5. vexx

    vexx Active Member

    I think we have Eaccelerator installed (i have to check, I manage more than 1 server). Do you think APC is worth more than eAcc?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Either works. I don't have enough experience with both of them to make a recommendation.
     
  7. Rudy

    Rudy Well-Known Member

    I need to set up this caching within the next few weeks.

    Is there any benefit to using APC as the backend vs. Memcache, or are they about the same performance-wise? I'm not certain if we have the PECL extension installed to use the latter (I can check next week). APC is already installed and running nicely. I may just roll with that.

    Just curious, has anyone tried this? http://framework.zend.com/manual/1.12/en/zend.cache.backends.html#zend.cache.backends.twolevels

    May not even be possible with XF but it uses a two-level cache. One fast (APC, Memcache) and one slow (SQLite, flat file).
     

Share This Page