Veröffentlicht am 3. Februar 2010 (vor 1204 Tagen)
A lot has already be speculated about what percentage of existing PHP users would benefit from using HipHop. The numbers seem to range somewhere between 0% and 100%. I will not try a guess myself, but rather try to shed some light on some the most important prerequisites I think there are for a company to benefit from HipHop.
As of today, HipHop does not support PHP 5.3 features, and does not support certain PHP 5.2 features like eval(). Let aside the fact that eval should be considered evil and not be used altogether, you cannot "just write" PHP code and assume that it works with HipHop. Thus, implementing and enforcing coding guidelines will become much more important than it is even today.
There will always be a functional gap between HipHop and PHP, since PHP evolves and introduces new features that HipHop must adopt. So HipHop will always lag a little behind. This is usually not a problem unless you need to use certain features of the latest PHP version. So coding for HipHop means defensive coding.
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.
It is unrealistic to assume that a larger code base currently running on PHP will produce exactly the same results on HipHop. Results can differ for example due to different implicit sort orders. Even if automated tests are in place to compare results of PHP and HipHop, those differences must be accounted for in the testsuites. This requires a flexible software architecture that allows for dependency injection and mocking of objects.
On the longer run, C++ skills and development tools will be required. Existing PHP tools like xdebug are not available on HipHop, since there is no PHP involved when the software is being executed on a production server. Any debugging at the level of C++ code will be hard, if not impossible, to relate to PHP code. Judging by my own C++ skills, debugging would just not be an option altogether. I fear this will hold true for the vast majority of PHP development teams.
Since PHP runs on virtually any web server, you can deploy the same script on an Intel or AMD processor, or even to a different operating system. PHP code, at least when written carefully, runs pretty much abstracted from the actual system environment.
HipHop produces C++ code that will be compiled into highly optimized machine language. Suddenly, processor architecture matters. Software cannot be compiled just once, but must be compiled and optimized separately for a each target architecture. With HipHop, you will either have to unify the architecture of your servers, or set up a compile farm that cross-compiles for the different server architectures. Compiling larger code bases can take a considerable amount of time, and every single software change forces you to recompile the software.
Deploying just a few modified PHP scripts is no longer an option, a large, monolithic binary has to be deployed. More complex build and deployment processes must be established. Apache or Lighty are no longer an option, HipHop comes with its own web server. All load-balancing, caching, proxying, URL-rewriting that currently takes place in the web servers must be adapted.
HipHop will reduce the load on your systems, but that does not necessarily mean shorter answering times for the users of your website. This is because I/O is where the action is. Accessing disks or the network is very slow compared to executing PHP code. As a matter of fact, when executing a PHP application, the computer on the average spends most of the answering time waiting for data to be loaded from external resources, or being stored to external resources.
Even if HipHop handles I/O faster than PHP does, it will not make your disks or your network faster. So all you can expect from using HipHop is the ability to serve more concurrent requests with the same amount of servers (or using fewer servers to serve the same amount of requests, of course). The most interesting question is whether your I/O backends, being the overall performance bottlenecks anyway, can keep up with serving an increased amount of concurrent requests. You might just have shifted your scaling problem. To determine the right scaling measures, a decent amount of thorough code profiling is required, and you might as well have to rethink your software architecture.
Turns out, you might have to walk a long road until you can even start to dance the HipHop.
Kommentare bitte per E-Mail.
Diplom-Informatiker Stefan Priebsch ist IT-Consultant, Trainer und Spezialist für die Entwicklung PHP-basierter Software.
Er ist Autor zahlreicher Bücher und Fachartikel über verschiedene Aspekte des Software-Lebenszyklus und spricht regelmäßig auf internationalen IT-Konferenzen.
Stefan Priebsch ist verheiratet und Vater von Zwillingen. Er lebt und arbeitet in Wolfratshausen bei München und ist Mitgründer und Principal Consultant von thePHP.cc.
"I have had the pleasure of interacting with Stefan at several PHP conferences. One thing I appreciate about Stefan is he provides a very balanced presentation between technical and practical business aspects. As an author and presenter, you immediately know you are in the hands of someone with practical experience, who is willing to share it with you. I always look forward to my next opportunity to work with Stefan."
--Jason Sweat, Deere & Company
Es wurde schon viel darüber spekuliert, wie groß der Anteil der PHP-Nutzer ist,
die von HipHop profitieren werden. Die Zahlen bewegen sich im Wesentlichen
zwischen 0% und 100%, daher versuche ich mich gar nicht erst an einer eigenen
Schätzung, sondern will stattdessen über die Voraussetzungen schreiben, die
ein Team beziehungsweise eine Firma erfüllen muss, um von HipHop profitieren zu
(vor 1196 Tagen)
» Blog-Eintrag lesen
A lot has already be speculated about what percentage of existing PHP users would benefit from using HipHop.
The numbers seem to range somewhere between 0% and 100%.
I will not try a guess myself, but rather try to shed some light on some the most important prerequisites I think there are for a company to benefit from HipHop.
(vor 1204 Tagen)
» Blog-Eintrag lesen
Der erste deutsche PHP Summit - powered by thePHP.cc - ist eine neue und
einzigartige Veranstaltung, die alle wichtigen Themen rund um die
Software-Entwicklung mit PHP in kompakter Form vermittelt.
(vor 1206 Tagen)
» Blog-Eintrag lesen
OOP Conference U.S.A. Blog MTA Derick Rethans Chicago Facebook Magento Workshop tek09 Montreal Presentation Migration Training PHP 5.3 Slideshare hack fail Webcast CodeWorks09 Sebastian Bergmann Relaunch HipHop Book Arne Blankerts MVC PHP thePHP.cc CRAP Selenium Feedback Slides Testing Wordpress PHP Quebec 09 C++ Canada Lifecycle Atlanta
RT @thePHPcc: 18 PHP Power Workshops in 3 Tagen? Klar geht das! Beim PHP Summit 2010 - http://phpsummit.de - Schnell buchen, bevor es zu ... (vor 1207 Tagen)
» Tweet lesen
New blog post: http://priebsch.de/blog/how-to-turn-bad-code-into-good-code/ (vor 1207 Tagen)
» Tweet lesen