Bigger Than HipHop? Facebook's New Virtual Machine
PHP is a web language used for website development, and currently one of the most popular among web developers. Facebook, like a lot of other popular websites, also uses PHP for its development. However, as an interpreted language, one drawback that comes with PHP is that the source code is executed by the processor, rendering it slower than C++ and other related languages.
To counter this problem, Facebook introduced the HipHop Virtual Machine, the first of Facebook’s attempts to accelerate PHP execution and reduce response time for the code. The HipHop Virtual Machine, or HHVM, is actually the next generation of Facebook-developed compiler HipHop, which was designed to convert PHP codes on its site into C++, thus making the interpretation process faster.
In past years, the HipHop compiler served Facebook with great flexibility. But as Facebook grew in size and pages started to become even more dynamic, Facebook authority sought newer ways to counter the lag in response time, and thus the HipHop Virtual Machine was born.
So what exactly is the HipHop Virtual Machine?
According to Joel Pobar, an engineering manager working for Facebook, it is designed to “make PHP run really, really quickly.” After three years in development, Facebook introduced the system this year, with all of its servers adopting the virtual machine at the same time. What exactly does this new system do?
The HHVM works under the same principle as the Java Virtual Machine (JVM) in the sense that the Just In-Time (JIT) compiler is present with both the systems- helping to compile human readable codes into machine readable ones. The smart thing about this JIT compiler is that it can identify user instructions to handle specific data types, arrays and databases to send and receive query requests and results based on what Pobar calls ‘critical reasoning’.
Another very big plus for the new HipHop is that it is designed to work with huge chunks of data, often handling millions of request at the same time without any lag in its response. Pobar believes that with the way it is structured, the HipHop Virtual Machine would actually produce less noticeable results for a standard website, increasing performance by only five times.
Facebook recently released HipHop’s code to the public; with the hope that other sites would use it as well, resulting in an overall faster web environment across all platforms. However, machines and servers that can cope with HipHop are still relatively rare, and if CPUs fail to handle the large amount of data the HipHop Virtual machine processes at any given time, the lack could still be prevalent. Nonetheless, Facebook’s attempt to introduce the new virtual machine has been welcomed by most, and only the future will tell how good it will be in the long run.