Download pptx - Daniel Sloof - MM14NL

Transcript
Page 1: Daniel Sloof - MM14NL
Page 2: Daniel Sloof - MM14NL

Magento on HHVMSpeeding up your webshop with a drop-in

PHP replacement.

Page 3: Daniel Sloof - MM14NL

Daniel Sloof

https://twitter.com/daniel_sloof

https://github.com/danslo

[email protected]

Page 4: Daniel Sloof - MM14NL

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

Page 5: Daniel Sloof - MM14NL

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

Page 6: Daniel Sloof - MM14NL

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

Page 7: Daniel Sloof - MM14NL

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

Page 8: Daniel Sloof - MM14NL

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

Page 9: Daniel Sloof - MM14NL

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.

Page 10: Daniel Sloof - MM14NL

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

Page 11: Daniel Sloof - MM14NL

Benchmarks: Response time

Average across 50 requests

Page 12: Daniel Sloof - MM14NL

Benchmarks: Transaction rate

While increasing siege concurrency until avg. response time ~2 seconds

Page 13: Daniel Sloof - MM14NL

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.

Page 14: Daniel Sloof - MM14NL

What the Hack?

Moving to HHVM gets even more awesome...● Statically typed language● Type annotations● Generics● Async● Lambda’s● Collections● Built-in user attributes

Page 15: Daniel Sloof - MM14NL

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

Page 16: Daniel Sloof - MM14NL

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/

Page 17: Daniel Sloof - MM14NL

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_Profilero Nexcess_Turpentine Danslo_HiphopIndexero Cm_Cache_Backend_Redis Aoe_Schedulero Made_Cache <your module?

>

Page 18: Daniel Sloof - MM14NL

Thank you...