Nginx + WordPress + HHVM: Why isn’t Batcache working? Would Varnish help even more?

I’ve heard great things about HHVM, so I’ve setup a copy of WordPress blog (on another domain) with Nginx (with the Pagespeed module) and HHVM. Right now the benefits are obvious: on the same config, load times are between two and three times faster.

I’m trying to speed up things a little bit, and I’ve also installed Memcached and Batcache. I’ve installed the memcached package, copied object-cache.php (Pastebin) onto the root folder of the WordPress blog, and after that I’ve installed the Batcache plugin and copied the advanced-cache.php (Pastebin) file onto the wp-content folder. Also, I’ve included the line

define('WP_CACHE', true);

in the wp-config.php file. It seems it doesn’t work, though. If I quickly reload the page several times Batcache should show the cached page, but it doesn’t. It’s easy to check that by reloading (Cmd+R on Chrome on OS X) the page several times and then viewing the page’s code. Under the <head> section I should see some batcache stats, but they aren’t there.

I wonder if someone could give me some hint on this.

On a side note, I don’t know if I could add some other component in order to help the performance be even better. I’m thing about Varnish, but I’m not sure if it’s just useless and it’s just another way to the same I’m currently doing. Any other component there? (I’ll test CDN for images, minifying js, etc and some other tricks as well, but I’m talking from the server perspective).

1 Answer
1

I guess the answer is that HHVM does not work with typical opcode caching, the compiler is not the same as “regular” PHP’s. HHVM has it’s own opcode caching that as far as I know does not integrate with APC or Zend’s OPcache, it does it’s own thing. In other words, it would be redundant.

You can read about it in detail here: http://hhvm.com/blog/4061/go-faster (comparison with APC).

You can however use HHVM’s caching with memcached ( at least I think you can) there are several issues and patches on HHVM’s github about this, https://github.com/facebook/hhvm

I have never used HHVM but there must be a way to test or debug the cache, that is probbaly your best route, plugins that take advantage of “regular” PHP like batcache will not show anything.

To test if it’s working turn off HHVM caching ( I think the settings are found under runtime options) and test the site with it off/on or with different cache settings.

Another option is to just define('WP_CACHE', true) in your wp-config.php file, and you can benchmark HHVM with this off/on and see if it has any effect.

You can see here a compatible list of PHP extensions that work with HHVM: https://github.com/facebook/hhvm/tree/master/hphp/runtime/ext

Leave a Comment