HipHop PHP LogoFacebook announced their open source project HipHop PHP yesterday and the web development community has been in a whirlwind of discussion about what this means, particularly for the PHP community.

HipHop PHP is essentially a compiler (although Facebook calls it a transformer) from PHP to C++. Only a subset of PHP functionality is compatible with the compiler but the developers say they only omitted some of the lesser used functions like eval(). The C++ code is truly cross-platform and can be compiled and run on virtually any server, the primary benefit being decreased CPU usage and therefore increased speed when delivering content to the end-user.

So, what does this mean for the CodeIgniter community? In short, absolutely nothing. Most CodeIgniter developers are building applications that will run on shared hosts, virtual private servers or a cloud-based virtualization system. Of that very large group of our community, an extremely small number have the capability to compile the HipHop binaries or alter their configuration in order to serve HipHop pages.

There are a very small number of CodeIgniter applications that are running on a couple of dedicated servers. Even these developers have no need for HipHop! The performance benefits gained by running HipHop on these server would be marginal at best, if even noticeable. These sites just don’t have the traffic to see measurable gains in performance by focusing on CPU usage. Their time is much better spent focusing on the standard bottleneck: input/output (database queries and caching of output).

Facebook 2009 Growth

It wasn’t until two years ago Facebook had enough traffic to make optimizing CPU usage a worthwhile focus of developer time. Compete won’t let me go back and look at traffic two years ago but I think the graph above speaks for itself: Facebook has more than doubled its monthly unique visitors in the past year. Most of us will be lucky to see .01% of that traffic on our applications (to put it more in perspective, codeigniter.com currently received .03% the traffic Facebook does).

10 Responses to “What does HipHop PHP mean for CodeIgniter?”

  1. wefsdg Says:

    >The performance benefits gained by running HipHop on these server would be marginal at best, if even noticeable. These sites just don’t have the traffic to see measurable gains in performance by focusing on CPU usage<

    But what if my site does aspire to have those levels of traffic? Are you saying codeigniter is not up to the job if it ever reaches them?

  2. Michael Wales Says:

    @wefsdg No – everyone’s site aspires to reach those levels. The point is, don’t worry about that bridge until you get there – you have far more important things to worry about (input/output). PHP only consumes CPU cycles when a file is being parsed (roughly the time it takes a page to render when requested). If you really analyze your server, I’d be willing to bet the system clock requires more CPU usage than PHP does over the course of a month (unless, of course, you are running a popular website).

    Why focus on saving 50% of 3% (CPU Usage) when you can focus on saving 10% of 30% (Database Queries)?

  3. wefsdg Says:

    Ok, so lets say for arguments sake that I DO have those levels of traffic. My I/O is now optimized 100% and CPU is now the problem. I now have to worry about it.

    >What does HipHop PHP mean for CodeIgniter?

    You have not answered this question in any way. Saying ‘you will never reach the levels needed’ is a sweeping generalization that doesnt apply to everyones application.

  4. Michael Wales Says:

    Then obviously you should give HipHop a try – there is nothing magic about CodeIgniter, it’s just PHP code. They’ve yet to release the source or tell us what features of PHP they failed to implement (other than eval()) so we really can’t setup an install of CodeIgniter running on HipHop to test or dig through the code looking for PHP functions that will not be supported just yet.

  5. wefsdg Says:

    so your answer to

    >>What does HipHop PHP mean for CodeIgniter?

    is essentially

    ‘i have no idea’.

  6. Michael Wales Says:

    From the narrow “the title of the post is the entirety of the content” view: yes. No one has any idea what HipHop means except for the Facebook developers.

    But, as this post describes, it would mean reduced CPU Usage. Maybe this post could be subtitled, “Should I worry about HipHop yet?”

  7. JackofSpades Says:

    Author +1

    Commenters, do I really need to say it? FAIL.

  8. Taner Ozdas Says:

    It is really interesting idea to use c++ for web. Maybe in the future will be used only one for web developers. I don2T know what time will show us, Lets see .

  9. di4bl0s Says:

    Code Igniter makes use of eval to for example create the DB object dynamicly depending on the db driver setup…
    so hiphop means NO GO for code igniter users…

  10. BDKR Says:

    The use of eval in CI is exceptionally easy to work around.

    That said, I see no reason why a business that is growing should not consider the use of HipHop as well as many other things (like memcache) sooner rather then later. It would be easier to deal with such a deployment when you are getting a thousand hits a day then 100K.

Leave a Reply