CrazyEngineers
  • Facebook Moves To Just-In-Time Compiler To Serve 800 Million Users Faster

    prabakaran

    Member

    Updated: Oct 18, 2024
    Views: 1.2K
    Facebook keeps on growing rapidly with huge number of people signing up daily, heading to 1 billion users. In the mean time, Facebook team is also aware of delivering the fast and better service to their users. To keep up with the pace of increased user base, Facebook moves to HipHop Virtual Machine (hhvm) with Just-In-Time compiler.

    Since the beginning, Facebook has used PHP as their server-side scripting language which is best to get adopted. But, when the application gets complex, the performance isn't so well with PHP compared to C/C++. This is the reason Facebook developed and #-Link-Snipped-#, as a free software in late february 2010, to convert the PHP code into optimised C++ and then it can be compiled with g++ to build binary files.

    With the help of HipHop for PHP and HipHop interpreter (hphpi), Facebook reported that they reduced their CPU usage to 50% when compared to Apache or PHP. That was great, but they still need to reduce the compile and run time, which was relatively high in their static compiler (HipHop compiler).

    This is why they developed this new high level stack-based virtual machine, hhvm by a team of nearly 20 peoples and even released it in GitHub. Using hhvm, they created a dynamic compilation system where the PHP is converted into <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree" target="_blank" rel="nofollow noopener noreferrer">Abstract Syntax Tree</a> and then into HipHop bytecode (hhbc).

    &nbsp;

    #-Link-Snipped-#

    This hhbc is then directy consumed by Just-In-Time compiler or interpreters to achieve dynamic compilation. The team working on hhvm is still pushing it hard to reduce the memory use and translation cache to get better performance with low CPU usage. Jason Evans, a software engineer who contributed to this project explained a bit more about hhvm in his #-Link-Snipped-# on Facebook, take a look at it to explore more of hhvm.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register