Does Prestashop work with HHVM?


Summary: If you keep a close eye on your online shop, and you really crave that increase in performance, then yes, you can use HHVM with Prestashop 1.6, especially if you regularly update to the newest version. Do expect some rough edges though.

Update: (December 2016) I no longer recommend running Prestashop on HHVM. PHP 7 has similar performance to HHVM and is officially supported by Prestashop since version 1.7. Since HHVM is still not on the Prestashop roadmap, you will probably get fewer bugs using PHP 7 than you would using HHVM.

Does it work? Does HHVM support the entire Prestashop codebase?

Yes, it works. As far as I can tell from running Prestashop/HHVM on a medium traffic shop, all the functionality of Prestashop 1.6 is supported by HHVM.

Should you use HHVM for Prestashop?

If you have a stable shop with satisfying results that’s kind of fast, you don’t need to move to HHVM just yet. The technology is not entirely stable, and you’ll risk losing orders due to the unavoidable bugs coming with a still relatively young technology.

If on the other hand the performance promises of HHVM make good business sense (because competition is very stiff or your shop is really too slow using PHP) or you just can’t resist using the newest technology, then it’s absolutely doable to move your shop to HHVM.

In the interest of stability, I strongly recommend using a configuration with fallback to regular PHP, so your Prestashop can continue serving customers while you figure out why HHVM just died on you.

What problems should you expect?

These are the problems that we encountered:

  • HHVM once crashed, just like that. Apparently it had run out of memory. Increasing the memory limits helped; it hasn’t crashed since then. If you don’t have a monitoring tool like Monit running - you should! - then now you have one more reason. These are the memory limits (in server.ini) that work fine for us with low to medium traffic.

hhvm.jit_a_size = 188743680 hhvm.jit_a_cold_size = 94371840 hhvm.jit_a_frozen_size = 188743680 hhvm.jit_global_data_size = 805306368

  • During the upgrade to HHVM 3.6.0, we ran into serious problems concerning the MySQL connection that I wrote about here (in German). We decided to keep version 3.5.9. Since then we’ve upgraded to 3.7.0, which seems to run just fine.
  • There was a mysterious problem with Prestashop not setting and unsetting cookies. Users could not register, which is of course a great way to lose orders. Having a working PHP-FPM configuration proved to be very useful, and it allowed us to just disable HHVM until the next upgrade.

What can you do to make it work?

  • Keep a close eye on the shop, and use a monitoring tool that tells you when a critical process like HHVM goes down (and tries to restart it).
  • Don’t forget to watch key performance indicators (like conversions) in your analytics too. Not all bugs lead to crashes, but many can send your customers elsewhere.
  • Use a fallback configuration! Here’s a working configuration for nginx, HHVM and PHP-FPM. If you’re using apache with PHP as a module, this could be a good time to switch to nginx with PHP-FPM. First make that work flawlessly, then add HHVM with a failover.
  • Be careful when upgrading HHVM. You might get rid of some bugs only to get new ones.

Good luck!

Permalink: /blog/does-prestashop-work-with-hhvm.html