Site icon Nabtron

APC vs Memcached, which one is best

The debate about the best never ends. Today one might be the best, tomorrow some other one! Same goes with caching plugins too.

Today a member asked in our group that which one of the caching plugin is best, APC or Memcached. Before going into detail let me clarify that memcache is different from memcached (will clarify their differences in another post).

What is APC and Memcached?

Just to tell someone who might not know what we’re talking about. APC (Alternative PHP Cache) and Memcached are the caching plugins for PHP based servers which let caching and saving the prepared output of the code / page to be delivered to the incoming request from visitor, instead of running the complete code over and over again with each incoming request.

This might seem bit weird as both are supposed to do different things and different type of caching, however keep reading and you’ll get to know the comparison hopefully.

APC vs Memcached, which one is best?

First have a look at the last version of APC. When was it released? and is it compatible with the latest version of PHP in first place?

APC

Well it turns out that APC is a dormant, possibly dead plugin and isn’t being actively developed anymore.

Last stable version: 3.1.13 (released: 2011 – 05 – 14)

Last beta version: 3.1.9 (released: 2012 – 09 – 03)

The stable release don’t support php 5.4+, however beta version is said to support them.

Wait a minute? you mean no beta release even for last 2 years? Yes! that’s what it mean! and no stable release since last 3 years!

Any serious programmer would know what does this mean, how many bugs needed fixed and how many performance improvements needed to be done. Not to mention, no stable support to the latest version of PHP.

Someone argued that but we don’t use latest version of PHP, well then, you should start using it, if your website is considered to be up to mark with latest technologies. As partial features of APC are already incorporated in latest version of PHP (5.5 currently) including opcache (might need to be turned on manually though)

Some argue that APC is best, no matter what it does but it’s best! because it’s going to be included in PHP 6! however they’re not ready to upgrade to PHP 5.5 even? And those who have done it already, they don’t need APC anymore, because PHP 5.5 included zend opcache already which can be turned on by simply un-commenting the settings, the way all other modules are turned on.

Memcached

Please note, memcached, not memcache (although similar).

Before we proceed, some might argue that memcached is flawed because it’s naming convention is wrong in first place, well I believed that too, but still we need to give credit to what it does, despite inappropriate naming convention.

Last stable version: 1.4.21 (released: 2014-10-12)

Supports latest release of PHP so far of course as it’s released just a couple of months ago!

Latest PHP (5.5) needs APC?

I hope it’s quite clear that when we compare APC with Memcached, Memcached gets preference, specially if you’re using latest version of PHP (5.5) as it incorporated zend opcode cache built in and just needs to be activated in settings, which is mostly considered to be a plus in APC over memcached.

So with latest version of PHP, you might not need APC at all!

Winner among APC and Memcached

First a diplomatic statement, the winner depends on your server environment, configuration, website code and specific requirements. However if you’re using a typical latest server with minimum stuff and need it optimized, go for memcached with zend opcode turned on for php 5.5 on nginx for example. Use it with w3 total cache on WordPress for maximum performance in most of the cases.

 

Exit mobile version