Tuesday, 26 October 2010

HipHop: emotions no-stop

Mhh... there's something strange....

Some months ago, Facebook annunced its new "HipHop" technology, used to speedup its servers. HipHop is a translator: when a page is requested for first time, HipHop transforms PHP source code in to a C++ source and then compiles it into native code with g++.The executable then is launched:its output is passed to the webserver.
Haiping Zhao, senior engeneer and HipHop chief, said HipHop speeds up to fifty percent Facebook servers. No bad, really. So, will we start to develop with HipHop in mind? I don't think so.

HipHop born with a specific target: to increase performances of one of most visited sites on earth. But, after thinking about it for some weeks I realized that better solutions could exist. Assuming as fundamental requisite that is impossible to rewrite ALL Facebook in another language and that most of programmers involved knows only PHP we can:

   1. write a PHP-to-Bytecode interpreter. JVM on server side is great: it's scalable and it has a JIT.
   2. create a front-end to LLVM. LLVM is a Virtual Machine AND a compiler. Apple is founding LLVM project, probably to use it as default compiler for its systems. LLVM supports multithreading.

HipHop technology seems to me as a return to the CGI. After ten years of mod_php (created to avoid CGI), Zope and other ways to reduce the use of CGI, we return to the root of web programming.

In my humble opinion, HipHop looks like more as a "patch" than an "entire solution". Facebook's engineers know well their work and they developed Cassandra DB from ground to up. A great work, well designed and well implemented (Java for scalability and fault-tollerance; replication; choice of a non-relational schema, ecc.). It sounds strange that Cassandra and HipHop came from the same home, because they seem too different. I think Apache Foundation is more coherent: Apache developers work on server-side with Java, with some exceptions in client and C/C  (such as Xerces and log4cxx).

I have no doubts that Facebook's administrators know well what's better for their business and I have no doubts they studied with attention to choose the best solution for their problem. But their solution seems very strange to me, and I would like to understand why they choose to create HipHop.
Post a Comment