My Take on Facebook's HipHop for PHP

Sebastian Bergmann » 03 February 2010 » in Articles » 4 Comments

Disclosure: Since Facebook Inc. is a customer of thePHP.cc, I might be considered biased. For the purpose of this blog posting, consider me taking off my "thePHP.cc hat" and putting on my "PHP Community hat".

HipHop for PHP

The Announcement

Yesterday Facebook Inc. announced "HipHop for PHP", a source code transformer that turns PHP 5.2 code (minus some features) into C++ code that can then be compiled with g++, for instance, to a regular binary.

The Summit

If you are following some key PHP community members on Twitter, you may have learned that a couple of weeks ago Facebook invited a select few to Palo Alto, CA to give them a sneak peek at the technology.

Terry Chay has a great summary of this event (including photos):


At the Summit
Facebook, Palo Alto, California

This "private summit" is one of the reasons why this announcement was preceded with a lot of rumors. I am not really interested in rumors (or conspiracy theories, for that matter), so I will focus on the technology and its impact here.

My Opinion

I am very happy — both as a "programming language geek" as well as an Open Source enthusiast — that Facebook Inc. decided to open source their solution to their problem. Understanding this is crucial:

  • Facebook had a problem.
  • Facebook found a solution for their problem.
  • Facebook decided to share their solution with the PHP community at large.
    Kudos for that!

Now what was their problem?

Facebook has a large code base that would take a long time (one to two years by my estimation) to refactor or rewrite in either PHP or another programming language to achieve the performance improvement that Facebook was looking for. During this time of refactoring or rewriting, Facebook would not have been able to innovate.

In the past, Facebook tried to achieve performance improvements by contributing to PHP as well as APC. Many PHP deployments benefit from this contributions today, but for Facebook they were simply not enough.

From this perspective it makes a lot of sense to dramatically change the way that they deploy and execute their PHP code: without major modifications to their existing code base they are able to run it with a CPU usage reduced by 50%:

"Facebook sees about a 50% reduction in CPU usage when serving equal amounts of Web traffic when compared to Apache and PHP.

Facebook's API tier can serve twice the traffic using 30% less CPU."

This is a sustainable solution for them as it allows them to benefit from PHP's advantages such as shorter development cycles and lower training costs — while at the same time, thanks to HipHop, reducing their data center costs.

What others are saying ...

Terry Chay is spot on when he summarizes the impact of HipHop in his blog posting:

"Arguing against PHP for performance reasons no longer holds water. [...]

In practice, you can get the advantages of having a scripting language without operational costs. [...]

HipHop is a showcase. With it the PHP world can point to Facebook as being the busiest site built in a scripting language in the world."

Stefan Priebsch (also with thePHP.cc) makes the point that you need to rethink your PHP development before you can dance to the HipHop beat:

"HipHop executes PHP code bypassing the Zend Engine, so there is no guarantee that a program will behave exactly alike on PHP and HipHop. More and better automated unit and integration tests will be required to allow you to compare the results on PHP and on HipHop, and determine whether deviations are to be interpreted as a bug, or can be tolerated."

I could not agree more: As there is a real build — including a real compilation — with HipHop, best practices such as coding standards and continuous integration will be even more important.

In conclusion, I would like to welcome "HipHop for PHP" to the PHP ecosystem. Yes, it is not a solution for a problem faced by 99.9% of the PHP deployments out there. But this does not make it less interesting in any way.

One more thing ...

PHPUnit runs on "HipHop for PHP", details can be found in the wiki.

Defined tags for this entry: , , , ,

Speaking at Conférence PHP Québec 2009

Sebastian Bergmann » 20 November 2008 » in Events » 0 Comments

Conférence PHP Québec 2009

I will present two sessions at the Conférence PHP Québec 2009:

Of Lambda Functions, Closures and Traits

Lambda Functions and Closures allow the quick definition of throw-away functions (for use with array_map(), for instance) that are not used elsewhere. Traits reduce some limitations of single inheritance by enabling the reuse method sets freely in several independent classes. This session introduces the audience to the implementation of lambda functions and closures (which are new in PHP 5.3) as well as traits (which will be added in PHP 6).

PHP Code Review (together with Stefan Priebsch)

Attendees of this lab will learn how experts look at code, what good code and bad code looks like, and how to avoid the most common gotchas. They are invited to bring their own code for an anonymous code review for an increased benefit from the lab.

See you in Montréal next March!

Defined tags for this entry: , , ,

PHP Code Camp in Bad Ems

Sebastian Bergmann » 16 October 2008 » in PHP » 0 Comments

PHP Code Camp

This blog posting is in German as the event it relates to is German-only. Sorry for the inconvenience. We are working towards an English edition of the PHP Code Camp, though.

Nach der großen und sehr positiven Resonanz auf die beiden ersten PHP Code Camps in München, Berlin und Zürich findet die nächste Veranstaltung vom 12. bis zum 16. Januar 2009 in Bad Ems statt.

Das innovative und neuartige Trainingskonzept des Camps enthält die Essenz aus den Praxis-Erfahrungen und den Spezialgebieten von drei der bekanntesten deutschsprachigen PHP-Profis. Das bietet Ihnen den Vorteil, dass Sie tiefgehendes Know-how von den führenden Experten jedes Themengebiets vermittelt bekommen. Sie werden stets gleichzeitig von mindestens zwei Trainern (meistens aber von allen dreien) individuell betreut – ideal für praktische Übungen und für die intensive Wissensvermittlung. Die Teilnehmerzahl ist auf 18 Personen limitiert. Melden Sie sich daher bitte frühzeitig an.

Sebastian Bergmann, Stefan Priebsch und Arne Blankerts zeigen Ihnen anhand von Praxisbeispielen die Best Practices der professionellen PHP-Entwicklung. Der Fokus liegt dabei immer konsequent auf dem produktiven Einsatz aller Methoden und Technologien! Nebenbei erfahren Sie viel Spannendes über aktuelle Themen und Trends der PHP-Community.

Alle Teilnehmer erhalten eine virtuelle Linux-Maschine, in der PHP und alle im Code Camp behandelten Werkzeuge installiert und lauffähig vorkonfiguriert sind. Bringen Sie daher bitte Ihren eigenen Laptop zum Camp mit. Als Voraussetzung für die Teilnahme sollten Sie Kenntnisse in der PHP-Programmierung mitbringen. Erfahrungen in objektorientierter Programmierung sind von Vorteil, aber nicht unbedingt notwendig.

Wir sind nicht nur während der Workshops für Sie da: Nach den intensiven Trainingseinheiten des Tages haben wir für Sie Abend-Events vorbereitet, bei denen Sie die Trainer und Teilnehmer in entspannter Runde kennen lernen und sich fachlich austauschen können.

Machen Sie sich fit für Ihre PHP-Projekte und lassen Sie sich die Chance für Ihre Teilnahme an diesem besonderen Event nicht entgehen!
Defined tags for this entry: , , ,

PHP Code Camp in Zurich

Sebastian Bergmann » 04 July 2008 » in PHP » 0 Comments

PHP Code Camp

This blog posting is in German as the event it relates to is German-only. Sorry for the inconvenience. We are working towards an English edition of the PHP Code Camp, though.

Nach der großen und sehr positiven Resonanz auf die beiden ersten PHP Code Camps in München und Berlin findet die nächste Veranstaltung vom 8. bis zum 11. September in Zürich statt.

Das innovative und neuartige Trainingskonzept des Camps enthält die Essenz aus den Praxis-Erfahrungen und den Spezialgebieten von drei der bekanntesten deutschsprachigen PHP-Profis. Das bietet Ihnen den Vorteil, dass Sie tiefgehendes Know-how von den führenden Experten jedes Themengebiets vermittelt bekommen. Sie werden stets gleichzeitig von mindestens zwei Trainern (meistens aber von allen dreien) individuell betreut – ideal für praktische Übungen und für die intensive Wissensvermittlung. Die Teilnehmerzahl ist auf 18 Personen limitiert. Melden Sie sich daher bitte frühzeitig an.

Sebastian Bergmann, Stefan Priebsch und Arne Blankerts zeigen Ihnen anhand von Praxisbeispielen die Best Practices der professionellen PHP-Entwicklung. Der Fokus liegt dabei immer konsequent auf dem produktiven Einsatz aller Methoden und Technologien! Nebenbei erfahren Sie viel Spannendes über aktuelle Themen und Trends der PHP-Community.

Alle Teilnehmer erhalten eine virtuelle Linux-Maschine, in der PHP und alle im Code Camp behandelten Werkzeuge installiert und lauffähig vorkonfiguriert sind. Bringen Sie daher bitte Ihren eigenen Laptop zum Camp mit. Als Voraussetzung für die Teilnahme sollten Sie Kenntnisse in der PHP-Programmierung mitbringen. Erfahrungen in objektorientierter Programmierung sind von Vorteil, aber nicht unbedingt notwendig.

Wir sind nicht nur während der Workshops für Sie da: Nach den intensiven Trainingseinheiten des Tages haben wir für Sie Abend-Events vorbereitet, bei denen Sie die Trainer und Teilnehmer in entspannter Runde kennen lernen und sich fachlich austauschen können.

Machen Sie sich fit für Ihre PHP-Projekte und lassen Sie sich die Chance für Ihre Teilnahme an diesem besonderen Event nicht entgehen!
Defined tags for this entry: , , , ,

PHP Code Camp in Berlin

Sebastian Bergmann » 18 March 2008 » in PHP » 1 Comment

PHP Code Camp

This blog posting is in German as the event it relates to is German-only. Sorry for the inconvenience.

Nach dem großen Erfolg des ersten PHP Code Camps in München findet die nächste Veranstaltung vom 9. bis 12. Juni 2008 in Berlin statt. Erleben Sie ein Trainingskonzept, das Ihnen tiefgehend und in besonders innovativer Form vermittelt, wie Sie PHP-Anwendungen professionell entwickeln können. Der Fokus liegt dabei immer konsequent auf dem Praxis-Einsatz aller Methoden und Technologien!

Zusammen mit Arne Blankerts und Stefan Priebsch werde ich Ihnen anhand einer Beispielanwendung, die sich als roter Faden durch alle Themenbereiche zieht, zeigen, wie Sie Ihre PHP-Anwendungsentwicklung verbessern können. Alle Teile des Workshops bauen aufeinander auf. In jedem Workshop-Block werden Sie von jeweils mindestens zwei Trainern betreut. So erhalten Sie immer eine optimale und individuelle Betreuung. Als Voraussetzung für die Teilnahme sollten Sie Kenntnisse in der PHP-Programmierung mitbringen. Erfahrungen in der objektorientierten Programmierung sind von Vorteil aber nicht zwingend notwendig.

Wir sind nicht nur während der Workshops für Sie da: Nach den intensiven Trainingseinheiten des Tages haben wir für Sie Abend-Events vorbereitet, bei denen Sie die Trainer und die anderen Teilnehmer in entspannter Runde kennen lernen können.

Machen Sie sich fit für Ihre PHP-Projekte und lassen Sie sich die Chance für Ihre Teilnahme an diesem besonderen Event nicht entgehen!
Defined tags for this entry: , , , ,