
HipHop for PHP in Production at Hyves - ma2rten
http://hyvesblogonproductdevelopment.blogspot.com/2011_10_01_archive.html
======
ck2
How does hiphop performance compare to fastcgi + opcode-cache (with stat
turned off)

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...](http://php.webtutor.pl/en/2011/05/17/drupal-hiphop-for-php-vs-apc-
benchmark/)

    
    
       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.

~~~
patangay
I work for facebook and I worked on the deployment of these large hiphop
binaries of our code base. We considered multiple options - binary diffs,
multicast, etc. The problem with multicast is that it's hard to configure and
maintain in our complex cross region datacenter setup that has to travel
through other peering networks.

We ended up with a torrent deployment system that scales beautifully.

~~~
Ramonster
We ended up doing exactly the same, I wrote a tracker for the bittorrent
deploy system that is aware of our network topology and able to transport
these 500Mb binaries to our frontend pool in < 3mins (300+ servers)

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 ?

------
FooBarWidget
For those who don't know, Hyves is the largest social networking site in the
Netherlands, although in recent times they're facing fierce competition from
Facebook. It's ironic that Facebook is indirectly helping them with HipHop.

~~~
marquis
That's the beauty of open source. Let the best implementation win, not the
competitor with the most marketing money. I have had this conversation with
older business-type people who don't quite understand why we might want to
make certain aspects of our code available, they just see it as enabling
competition but everytime a competitor has come along it just energizes us to
innovate harder and over the years I can look back and see that some of our
best work was done in the months after a new potential competitor appeared.

------
willemst
I work at Hyves and wrote this article. If you have any questions on our use
of Hiphop, please ask here and I will try to answer any questions.

~~~
toumhi
he Willem, you still work there? First time I see Hyves on first page at HN. I
didn't even know they were writing a blog on product development. How's it
working? Are you writing articles alone, or are several guys writing on what
they are working on? Very good idea in any case.

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...

~~~
willemst
Ti toumhi! Don't worry, how can I forget the only Frenchie at Hyves?

~~~
toumhi
hehe good - but it seems you eluded my questions ;-)

------
jurre
I'm wondering, if several engineers spent months porting their php code to
hiphop, wouldn't they be better off just rewriting critical parts of their
code base to c++?

~~~
j_col
If HipHop supports 99% of PHP 5.3, then it took them months to change 1% of
their code. Changing any more than that would have obviously taken longer,
especially to a whole other language.

~~~
willemst
I would like to elaborate a bit on this. Currently, Hiphop supports 99% of the
PHP 5.3 features. When we started working on Hiphop, less was supported.

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.

~~~
ojilles
Willem, how much of the performance improvement was related to Smarty
templates being compiled to C++ vs. the application itself?

~~~
willemst
We did not measure this separately. With Hiphop, you compile a bunch of PHP
files to a binary executable file. Once you have this file, you cannot load
any new PHP files like you can with vanilla PHP. So including the Smarty
templates is kind of mandatory.

~~~
ojilles
Aha I see. Thnx for the follow up.

------
j_s
If I were making the decision on where to move my PHP code now, would
Phalanger be a better alternative than HipHop?

\---

<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/>

~~~
omouse
Wtf does it mean to be a complete PHP implementation? As far as I know,
there's no standard specification for the whole language, there's not even an
EBNF grammar. There's no ISO or ANSI effort to standardize it either.

~~~
j_s
Perhaps feature compatibility with a particular version of the normal PHP
interpreter? This would be the opposite of HipHop's lack of support for
certain PHP features.

The referenced post states "It is so complete that it can run both MediaWiki
and WordPress out of the box."

------
radagaisus
They have a code base of 3.5M LOC and 10M users.

~~~
ojilles
Complexity is the root of all evil. There's been some publications [1] that
compare revenue per employee which sometimes is interesting. For
technologists, it might actually be interesting to see LOC per User. Hyves
seems to run at 1/3rd of a line per user; is that high or low? Any published
stats like that?

[1]: [http://37signals.com/svn/posts/2283-ranking-tech-
companies-b...](http://37signals.com/svn/posts/2283-ranking-tech-companies-by-
revenue-per-employee)

------
j_col
Great to read about other large-scale users of HipHop, thanks for posting. The
last graph on CPU usage says it all really.

