*** Personal note: It has been suggested that this may reflect an official Magento position. It does not. I like doing research and I like publishing what I find as long as I find it interesting and it isn’t tied to a customer. So if you’re wondering if this reflects a change in Magento or some kind of future roadmap, it does not. ***
I was recently asked by a client about Magento and HHVM support. While the answer is “don’t touch it in production and there’s no guarantee of support” it did spur in me the insatiable desire to create charts. I’m curious about it and I’m sure you are too.
One of the things I’ve been curious about is how much juice could we squeeze out of the HHVM/Magento combo? In other words, how fast could Magento Enterprise 1.14 actually be?
My test setup is my crappy local VM. 8GB of RAM with 4x Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz. I had intended to test with Redis (boy do I have a fascinating blog post coming up there!) but there seems to be an odd thing that occurs to HHVM when dealing with reading from sockets that have buffered data 16k or greater. Since HHVM uses FastCGI that meant that for a proper comparison I needed to use Nginx with PHP-FPM. So I used the Cm_Cache_Backend_File instead. While my goal was to see if HHVM was faster than standard PHP for Magento I also wanted to see how many more requests per second I could squeeze out of it.
The answer to the latter question is; a whole shitload.
The test was simple. Hit the front page of a FPC-enabled site with JMeter and see what happened (0 – 25 concurrent connections and down again). Here’s what happened.
PHP-FPM peaks at just under 200 requests per second
HHVM Peaks at, wait for it, over 300 requests per second.
That is 300 freaking MAGENTO requests per second on a 4 CPU box!
Now, lest you think I’m suggesting you use HHVM, I’m not. It was not easy getting it to work and I wouldn’t trust it with a full workload. PHP 7 is also supposed to have similar improvements. And this was a test of one page, to see what was possible with one piece of functionality. But it’s an interesting indication of the improvements that are being made in the PHP ecosystem as a whole thanks to the introduction of HHVM. Perhaps PHP 7 will render HHVM moot. If that’s what happens, it’s fine by me. I’m just glad that we are finally starting to see some forward momentum on addressing some of the performance issues that have been inherent in PHP for quite some time. A little bit of creative destruction, now and then, is a good thing.