Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HipHop instead of XCache?

Tags:

php

xcache

hiphop

Would it make sense to switch to HipHop instead of XCache?

Is HipHop ready for primetime or should we wait several months before implementing it?

Edit: we are interesting in testing the configuration on a server running vBulletin.

like image 204
Marco Avatar asked Mar 18 '10 06:03

Marco


2 Answers

Let me clear up a misconception you might have about Hiphop and Xcache. XCache works by adding Opcode caching to ZEND's PHP implementation (like APC and friends), while Facebook's HipHop allows for PHP code to be transformed into C++ code and then compiled using g++. It's not possible to run XCache with HipHop as HipHop doesn't depend on Zend interpreter (and doesn't even use php opcodes as it's compiled to bytecode after transformed to C++).

Now to answer your question, HipHop is being used live to host a large amount of Facebook's traffic. Facebook wouldn't release this project if it wasn't near stable, but since it is very new I would still exercise caution. HipHop is not just a patch to the old Zend Interpreter, it is a completely different way to run the PHP code and will probably have a few bugs in it.

One thing that Facebook did to ensure that Hiphop was working before they switched to it was they were able to setup very rigorous unit tests of each possible request on their site. That way if the output from Hiphop was different from the normal Zend PHP, they would go back and debug some more until everything "worked for them". Just because it "works" on Facebook code base doesn't prove that it'll work for yours. If you do decide to switch to HipHop, make sure to test it well.

EDIT:

HHVM (new VM version of HPHP) can now eval and create_function. They should be the same for all/most meaningful reasons.

There are a few things that aren't compatible with HipHop. They removed the eval and create_function functions. They also only support PHP 5.2.x for now, but they are plan to add support for 5.3 "soon".

like image 191
Kendall Hopkins Avatar answered Nov 09 '22 15:11

Kendall Hopkins


I like the idea of HipHop, so don't get me wrong here, but there is something to remember: HipHop is not for everyone. From Sebastian Bergmann:

it is not a solution for a problem faced by 99.9% of the PHP deployments out there

Unless you have Facebook proportion traffic and your bottleneck is CPU or memory usage, you're not likely to see much of a benefit (as compared to xcache, apc, etc). Database and file system access are still going to be your killers.

like image 34
Justin Johnson Avatar answered Nov 09 '22 13:11

Justin Johnson