Daniel Sloof - MM14NL


Published on

HipHop Virtual Machine

HHVM is een alternatieve PHP runtime ontwikkelt door Facebook. In sommige gevallen is deze runtime tot 10x sneller dan ‘normaal’ PHP. In deze sessie zal Daniel uitwijden over hoe Magento op HHVM draait, waar de struikelblokken liggen en welke performance verbeteringen je kunt verwachten.

Published in: Software, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Daniel Sloof - MM14NL

  1. 1. Magento on HHVM Speeding up your webshop with a drop-in PHP replacement.
  2. 2. Daniel Sloof https://twitter.com/daniel_sloof https://github.com/danslo daniel@rubic.nl
  3. 3. What is HHVM? ● HipHop Virtual Machine ● Created by engineers at Facebook ● Essentially a reimplementation of PHP ● Originally translated PHP to C++, now translates PHP to bytecode ● Just-in-time compiler, turning generated bytecode into machine code ● In some cases 5 to 10 times faster than regular PHP
  4. 4. Bytecode compilation Modified? Invalidate cache Compile to Bytecode Run Bytecode No Yes● PHP5 style bytecode execution ● APC-like caching of bytecode ● Performance is quite similar to Zend PHP
  5. 5. Just In Time Compiler Modified? Have Native? Hot? Invalidate Cache Compile to Bytecode Run BytecodeCompile to Native Run Native No No Yes Yes Yes No
  6. 6. So what’s the problem? ● HHVM not entirely compatible with PHP ● Magento’s PHP triggering many of these incompatibilities ● Choosing between ○ Forking Magento to work around HHVM ○ Fixing issues within the extensive HHVM C++ codebase
  7. 7. Resulted in... fixing HHVM ● Already over 100 commits fixing Magento related HHVM bugs; ○ SimpleXML (majority of bugfixes) ○ sessions ○ number_format ○ __get and __set ○ many more... ● Most of these fixes already merged back into the official (github) repository
  8. 8. What that means for Magento... ● Community and Enterprise Editions running stable. ● Passes 100% of the Test Automation Framework. ● Large boost in improvement. ● Works with FastCGI, so keep most of your current web-configuration, rewrites, etc.
  9. 9. Benchmarks Before we go to the results... ● Magento 1.8 with sample data ● Standard nginx / php-fpm / percona stack (with PHP 5.5 opcode cache) ● Standard HHVM configuration (repo- authoritative mode disabled, JIT enabled) ● Tool of choice: siege
  10. 10. Benchmarks: Response time Average across 50 requests
  11. 11. Benchmarks: Transaction rate While increasing siege concurrency until avg. response time ~2 seconds
  12. 12. What about <insert caching mechanism here>? ● HHVM does not get in the way ● Dynamic content still needs to be generated ● Replaces PHP - not Varnish, Redis, FPC, Block Cache, etc. ● As long as you are burning CPU cycles (always), you will benefit from HHVM ● Think about speeding up indexing, order placement, routing, etc.
  13. 13. What the Hack? Moving to HHVM gets even more awesome... ● Statically typed language ● Type annotations ● Generics ● Async ● Lambda’s ● Collections ● Built-in user attributes
  14. 14. Possible issues ● Third party modules may still trigger HHVM incompatibilities ● Bleeding edge software, especially in regards to Magento ● Relatively hard to fix issues due to complex HHVM codebase
  15. 15. Gradually migrating...? You have an existing store, but: ● you are not willing to commit to running your entire website on HHVM, or; ● maybe you are running Ioncube extensions which make your store incompatible But you still want to run certain parts of your website (indexing!) through HHVM? Possible! https://github.com/danslo/HiphopIndexer/
  16. 16. One more thing... Testing Magento modules publicly: ● URL: https://github.com/danslo/Magento- HHVM-Module-Compatibility ● Uses Magento Composer Installer ● Some supported modules: o AW_Blog Aoe_Profiler o Nexcess_Turpentine Danslo_HiphopIndexer o Cm_Cache_Backend_Redis Aoe_Scheduler o Made_Cache <your module?>
  17. 17. Thank you...