Xcache VS APC at Linode server

Hello members

I am currently looking for ways to better improve my existing LINODE 8GB box using APACHE2/MYSQL/PHP.

I am currently using Memcached for database caches and I would like to know according to your experience what to choose between APC or XCACHE? And why?

can I use both?

Thanks for your contributions

Regards

Cloud Dreamer

5 Replies

i would like to hear opinion too . We have LiteSpeed and xcache now

I use APCu but I have never tried any of the others.

For me APCu works incredibly well, but I use it as part of my code from the start, I don't know how it works as a bolt on to web apps not designed with it in mind.

Only major issue with APCu is that the cache is cleared on an apache restart, if that is not acceptable then APCu probably isn't for you.

"APC" as in literally APC is basically broke, it hasn't been updated in a long time and basically needs hands-on source patching if you're using anything 5.4 or higher for PHP. APCu as noted by another user is basically the spiritual successor to APC.

Personally I still make use of xcache largely, but it's worth noting that PHP 5.5 and above have it's own built in opcode caching so xcache, APCu, etc may not even be necessary.

As for the major issue noted, that issue of APCu actually applies against xcache and even native opcode caching, it depends entirely on how your PHP is configured. If your apache is loading it as a cgi model, mod_php, etc, it flushes it because your restart of apache basically restarts the loaded PHP as well (which is why php.ini changes need an apache restart in those cases), if you're using php-fpm, then apache restarts should not effect the opcode cache.

Edit: If you're looking for real performance tuning and aren't doing like shared hosting of some sort on your VPS (ie; cPanel or similar), you may wish to look into nginx or lighttpd w/ a php-fpm configuration.

My linode's and servers outside of linode generally run a lighttpd+php-fpm stack with either mariadb or percona.

I use php 5.6.x (apache mod_php) and where I find APCu beneficial is caching of database queries and complex server-side DOM manipulation. When the web app doesn't have to repeat those things once it has done them, it is much more responsive.

With respect to nginx, it's fantastic for static content but benchmarks I've seen with dynamic php I haven't seen big enough of an improvement to switch from the devil I know (apache) to something new, a lot of the benefits it had over apache have been improved in apache and/or are not an issue with apache if using a cdn for static content.

For example, you site gets slashdoted - with apache, serving the page and all the css / js / images from same apache could take it down but if static resources are on a CDN so apache doesn't need to serve that content, apache itself often does fine.

@AliceWonder:

I use php 5.6.x (apache mod_php) and where I find APCu beneficial is caching of database queries and complex server-side DOM manipulation. When the web app doesn't have to repeat those things once it has done them, it is much more responsive.

With respect to nginx, it's fantastic for static content but benchmarks I've seen with dynamic php I haven't seen big enough of an improvement to switch from the devil I know (apache) to something new, a lot of the benefits it had over apache have been improved in apache and/or are not an issue with apache if using a cdn for static content.

For example, you site gets slashdoted - with apache, serving the page and all the css / js / images from same apache could take it down but if static resources are on a CDN so apache doesn't need to serve that content, apache itself often does fine.

In all honesty it depends kind of how you have it configured, a php-fpm configuration under either lighttpd or nginx will pretty much always smoke Apache in any configuration with exception of static content (Apache actually still rocks generic content fairly well last I saw). Any benchmarks not showing an improvement were more than likely due to bad configurations in all honesty, most likely configurations not designed to scale at the emulated traffic levels they were attempting to benchmark.

I still work with a client that runs an old half-crappy CakePHP 1.3 site off a single (albeit beastly) dedicated server, rolling lighttpd+php-fpm(w/ xcache)+mariadb(all XtraDB)+memcached, and we've effectively taken large reddit surges without so much as a sweat for the most part, largely due to a combination of the php-fpm configuration and a lot of query caching in memcached. Without reddit surges that site rocks around 2-3k hits a minute on a low average with a framework response time around 40-60ms, and normally at most we use 4-5GB of memory at the higher-end of stuff with 10-20% CPU load (load average of 1), also doing 10+ TB a month in traffic outbound.

Never ever under-estimate a decent properly done configuration for any stack, even on a single server :P

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct