XF 1.2 Caching question

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!
 

Brogan

XenForo moderator
Staff member
Both frontend and backend are required.
The frontend enables the cache.
The backend defines the type.
 

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,
)
)
);
 

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.
 

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?
 

Jake Bunce

XenForo moderator
Staff 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?
Either works. I don't have enough experience with both of them to make a recommendation.
 

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).
 
Top