Memcached with OPcache

WebEndev

Member
Hello.

Two days ago, I had a client sign up for the SSD-1 VPS plan. I was surprised to see that the VPS was created with Apache 2.4.12 (vs 2.2), mySQL 5.6.22 (vs 5.5), and PHP 5.5.21 (vs 5.4). Apparently KH is moving forward with the latest and greatest as a standard, which is great!
Another surprise was that PHP was set up as DSO with mod_ruid2. A very fast configuration, which I have been using myself for quite a while. I'm wondering if this is the new KH standard now also?

Anyway - back to my main question -
PHP 5.5 has Zend OPcache built in, which from what I have seen has better performance than APC. I like the idea of using OPcache, but as we know, it is only an opcode cache, and does not have the data cache component that APC has.
So I have been looking at options for data caches, and I have narrowed it down to either memcached or APCu. The reasons are that these two seem to be the best maintained (memcache is not).

What are the thoughts on memcached with OPcache? Does anyone use it?

Thanks!
 
Last edited:

Dion

Member
APCu would be my choice of the two, but IMO it's a "lesser of two evils" choice. ;)

I've found that data caches cause more harm than good. Examples would be WordPress and Joomla admin settings not being properly updated, and phpBB and Mediawiki displaying incorrect information to users. The problem is that these programs' cache drivers are brain-dead -- they cache data/queries even when it could be disastrous to do so.

I use OPcache with no data cache and am very happy with its performance in all the above applications.
 

Dion

Member
Nowhere do I see that the plugin allows you to disable the cache in the admin panel. That's where the disastrous problems with data caches exist in WordPress. If it does support disabling the cache in the admin panel, I would use it with APCu and not Memcached (see above).

You could also install PHP-FPM. :)
 

KH-Jonathan

Director of Managed Services
Staff member
I use OPcache with no data cache and am very happy with its performance in all the above applications.
This is what we use on most KH systems and our sites are pretty darn fast :) The forums do run APCu in addition to ZendOpcache. Everything else is just ZendOpcache. I think I've got them all off of APC now.
 

WebEndev

Member
Yes, the plugin disables the cache by default, and you have to change a setting in the plugin to have it NOT be disabled. So that is covered.

I am now leaning with APCu instead. Looks to be the best of the two.

Installing PHP-FPM is just a bit too 'aggressive' for me, given that it isn't supported via cPanel yet. Not that I wouldn't love it... ;)
 

WebEndev

Member
The forums do run APCu in addition to ZendOpcache. Everything else is just ZendOpcache
Yes, I think APCu is what I will try. I will try to do some testing and if I do I'll post the results.
 

KH-Jonathan

Director of Managed Services
Staff member
Yes, the plugin disables the cache by default, and you have to change a setting in the plugin to have it NOT be disabled. So that is covered.

I am now leaning with APCu instead. Looks to be the best of the two.

Installing PHP-FPM is just a bit too 'aggressive' for me, given that it isn't supported via cPanel yet. Not that I wouldn't love it... ;)
PHP-FPM is supposed to be coming in EasyApache 4 which is supposed to be in cPanel 11.50, aka the next release.
 

Dion

Member
Hmm...I wonder how cPanel is going to deal with the FPM pools? That should be VERY interesting...
 

Dion

Member
I looked through the 11.50 information and unless I missed it, EasyApache 4 is not part of the release. I did notice in other documentation, however, that EasyApache 4 will no longer build Apache/PHP from source -- it will create builds from RPMs. That means I'll stick with the current EasyApache because I need the PHP interactive CLI, and no RPM builds PHP with the --with-readline option.

Just found a "gotcha" with the new EasyApache 3.30.0. It now includes Zend OPcache as a PHP option, and by default it's disabled. Those who had manually enabled Zend OPcache in previous builds will need to make sure to enable the OPcache option, or it will not be available.
 

WebEndev

Member
I looked through the 11.50 information and unless I missed it, EasyApache 4 is not part of the release. I did notice in other documentation, however, that EasyApache 4 will no longer build Apache/PHP from source -- it will create builds from RPMs. That means I'll stick with the current EasyApache because I need the PHP interactive CLI, and no RPM builds PHP with the --with-readline option.

Just found a "gotcha" with the new EasyApache 3.30.0. It now includes Zend OPcache as a PHP option, and by default it's disabled. Those who had manually enabled Zend OPcache in previous builds will need to make sure to enable the OPcache option, or it will not be available.
I just read here, that EasyApache 4 will be in release 11.52.

Dion - what is lost with PHP interactive CLI? Forgive my level of understanding in this area... :(

The "gotcha" is good to know!
 

KH-Jonathan

Director of Managed Services
Staff member
This does a better job of explaining the PHP CLI interactive mode than I could ever do:

http://us2.php.net/manual/en/features.commandline.interactive.php
Why not just have 2 SSH tabs open. Nano in one editing your file/scripts, and the other "php filename.php" to execute whatever you're working on?

Never used PHP interactive CLI myself. Maybe if I did it'd be hard to get away from but it's easier not to at least looking at it from the outside lol
 

WebEndev

Member
Why not just have 2 SSH tabs open. Nano in one editing your file/scripts, and the other "php filename.php" to execute whatever you're working on?

Never used PHP interactive CLI myself. Maybe if I did it'd be hard to get away from but it's easier not to at least looking at it from the outside lol
Yeah, I could live without the interactive CLI. I'm lucky to type.... :p
 

Dion

Member
Why not just have 2 SSH tabs open. Nano in one editing your file/scripts, and the other "php filename.php" to execute whatever you're working on?
I used to do PHP primary development that way (edit in one tab, execute PHP in a second tab). The interactive CLI made it much simpler to develop code blocks. I do use the two-tab process for debugging after the script has been put together.

I will note that all the cool kids use WAMP/MAMP installs and have no need to debug remotely via SSH. ;)
 

WebEndev

Member
WebEndev, how did APCu work out for you?
Hi Christopher,

I did some before and after benchmarks on a mildly complex WordPress site. There was no significant difference in page load times.
So I'm following Dions advice, and not pursuing it.

So now I'm just waiting for Centos 7 and PHP-FPM :)
 
Top