APC / Memcached / Both?

James

Well-known member
So I'm not an expert (or even an amateur or novice) in the areas of caching but I'm trying to learn 'cause every little helps.
(rambles with myself in the hope that someone will correct my nonsense)
From what I've been reading, APC is non-distributed and is an opcode cache. Opcode caching means that the compiled PHP script is cached so that the script isn't being compiled on each request for it, it can just be read from the cache.

Memcached is a distributed caching mechanism and is used if your site is running on different servers (loadbalancing comes to mind) so the cache is available across all servers and not just the server that it's cached on (in layman's terms, it's like a shared cache - right?)

Now, once I've finished rambling I've come to the conclusion that memcached should only be used if I'm utilising multiple servers for my site, and APC should be used no matter what because it is caching scripts to save resources.

So, (on a single server installation) would I be best off just sticking to APC, or utilising memcached too for XenForo (if this is even possible)?
 
There is no point using memcached in a single server environment considering that it is only a data cache which APC is also. Stick APC on, ensure the opcode and data caches are big enough to hold your compiled scripts and data and away you go. Plus you have no overhead of network latency when talking to APC on the same server. Memcached can be called via sockets but the developers recommend using the network transport to access it.
 
James,

the config.php changes will only activate APC for data caching, not opcode caching, that is mostly automatic depending on file size limits.
 
FWIW, on this site we use APC alone, and we don't have any cache setup in our config.php.
With muilt sites would it be best to add "XCache" which ive just installed this second to the config.php?
ensure the opcode and data caches are big enough to hold your compiled scripts and data and away you go

How can i do this sir? am very new to APC in fact only today i was asking about them

Thanks
 
With muilt sites would it be best to add "XCache" which ive just installed this second to the config.php?

Thanks

XCache is another good opcode cache product but for me development seems to have slowed down, another plus for APC is that it is now going to be included in the core of PHP6 so will receive a lot of developer attention over time. Personally I used to use XCache and a copy of memcached on another server but since I rebuilt my platforms have decided on APC. I didn't use the version of APC included in the distro as that often lags behind the current release so I use it directly from PECL.
 
Top Bottom