HipHop for PHP in Production at Hyves
hyvesblogonproductdevelopment.blogspot.com
hyvesblogonproductdevelopment.blogspot.com
I remember reading that on paper it seems it should be faster but in reality not so much.
Ah okay, hiphop IS faster:
http://php.webtutor.pl/en/2011/05/17/drupal-hiphop-for-php-v...
environment [req/sec][ms/req][%]
Regular PHP 15.10 66.242 100%
PHP + APC 46.90 21.321 310%
HipHop 77.01 12.985 510% (1.6x faster than apc)
http://huichen.org/en/2010/06/wordpress-3-benchmark/ wp3+php+apc 30.86 32.400
wp3+HipHop 43.50 22.990 (1.4x faster than apc)
Maybe multicast could be used on the intranet for distribution - but 500mb monolithic binaries sounds kinda insane.We ended up with a torrent deployment system that scales beautifully.
The tracker is opensource: https://github.com/hyves-org/p2ptracker
We're working on open sourcing more moving parts of our deploypipeline.
I'd be interested to compare notes on your system ?
Don't define constants where the name of the constant is a variable, as in "define($key, $value)"
Don't use "current($a)" to get the first element of an array $a, but use "reset($a)". current returns whatever element the internal array pointer points to, and PHP changes that pointer in crazy/undefined ways. Hiphop has a saner way to handle that pointer, but it's not the same as in PHP so your code might break if it's dependent on the specificities of PHP. In general use current only in case you are explicitly handling the internal pointer (that is, you are also calling reset/next).
Under the compiled version of hiphop, class_exists returns true for (almost) all the classes even if you haven't already included the file where they are defined, since they are all statically compiled.
Don't rely on destructors being called at the end of the requests: under hiphop they aren't. So either the object happens to be destructed during request execution (due to its reference count going to 0), in which case the destructor is called, or the object is garbage collected at the end of the request and its destructor is just ignored.
There are some differences in the handling of SOAP errors in Hiphop.
This will give a fatal error in Hiphop but not PHP: $z = null, $z[0] = "foo";
You can consult these Hiphop docs: https://github.com/facebook/hiphop-php/raw/master/doc/incons... and https://github.com/facebook/hiphop-php/raw/master/doc/incons... for a list of other inconsistencies between PHP and Hiphop.
The Hiphop project started of because one engineer thought it was "really cool" and when he was able to produce impressive benchmarks, we put some more company effort into it.
Anyways, good luck with the fight against Facebook ;-)
BTW, if you don't recognize me, I was the only frenchman working there at the time...
Stuff like closures, eval(), create_function(), constants with dynamic names (e.g. defining constants from an array) and class destructors were all not supported. Some more subtle stuff: you cannot use current() to get the first element of an array in Hiphop, class_exists() always returns true.
We also had to port our custom PHP extensions.
Finally, we spend a lot of time on related stuff such as precompiling all Smarty templates (so that the generated PHP gets translated to C++ too), using Hiphop's daemon system and setting up compile, build and deploy systems.
---
http://tirania.org/blog/archive/2011/Dec-21.html
"This year the Phalanger guys released Phalanger 3.0 which now runs on Mono (previously they required the C++/CLI compiler to run). Phalanger's performance is impressive as it is just as fast as the newly announced Facebook HipHop VM for PHP. The major difference being that Phalanger is a complete PHP implementation and the HipHopVM is still not a complete implementation." - Miguel de Icaza
Phalanger http://phalanger.codeplex.com/ http://www.php-compiler.net/
The referenced post states "It is so complete that it can run both MediaWiki and WordPress out of the box."
Facebook used to be pretty unknown here in the Netherlands, but is growing in popularity, with Hyves losing. They were acquired last year by a newspaper and media conglomerate Telegraaf.
[1]: http://37signals.com/svn/posts/2283-ranking-tech-companies-b...