HipHop 而不是 XCache?
切换到 HipHop 而不是 XCache 有意义吗?
HipHop 准备好迎接黄金时段了吗?还是应该等几个月再实施?
编辑:我们有兴趣在运行 vBulletin 的服务器上测试配置。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
让我澄清您对 Hiphop 和 Xcache 的误解。 XCache 的工作原理是将 Opcode 缓存添加到 ZEND 的 PHP 实现(如 APC 和朋友),而 Facebook 的 HipHop 允许将 PHP 代码转换为 C++ 代码,然后使用 g++ 进行编译。不可能使用 HipHop 运行 XCache,因为 HipHop 不依赖于 Zend 解释器(甚至不使用 php 操作码,因为它在转换为 C++ 后编译为字节码)。
现在回答你的问题,HipHop 正在被用来承载 Facebook 的大量流量。如果这个项目不稳定,Facebook 不会发布它,但由于它非常新,我仍然会谨慎行事。 HipHop 不仅仅是旧 Zend Interpreter 的补丁,它是运行 PHP 代码的完全不同的方式,并且可能会存在一些错误。
Facebook 在切换到 Hiphop 之前为确保 Hiphop 正常工作所做的一件事是,他们能够对其网站上的每个可能的请求设置非常严格的单元测试。这样,如果 Hiphop 的输出与正常的 Zend PHP 不同,他们会返回并进行更多调试,直到一切“对他们有用”。仅仅因为它在 Facebook 代码库上“有效”并不能证明它也适用于您的代码库。如果您决定转向 HipHop,请务必对其进行良好的测试。
编辑:
HHVM(HPHP 的新 VM 版本)现在可以
eval
和create_function
。出于所有/最有意义的原因,它们应该是相同的。有一些东西与 HipHop 不兼容。他们删除了eval
和create_function
函数。他们目前也只支持 PHP 5.2.x,但他们计划“很快”添加对 5.3 的支持。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
andcreate_function
. They should be the same for all/most meaningful reasons.There are a few things that aren't compatible with HipHop. They removed theeval
andcreate_function
functions. They also only support PHP 5.2.x for now, but they are plan to add support for 5.3 "soon".我喜欢 HipHop 的想法,所以请不要误会我的意思,但有一点要记住:HipHop 并不适合所有人。来自塞巴斯蒂安·伯格曼:
除非您有 Facebook 比例的流量并且您的瓶颈是 CPU 或内存使用,否则您不太可能看到太多好处(与 xcache 相比, apc等)。数据库和文件系统访问仍然是你的杀手锏。
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:
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.
我相当有信心 vbulletin 3.x 不能与 HipHop 一起使用。 VB 3 的插件系统由散布在整个代码中的近 2000 个 eval 语句组成,并且 hiphop 不支持 eval。
当谈到编译 vbulletin 时,这可能只是冰山一角。
I'm fairly confident that vbulletin 3.x will not work with HipHop. VB 3's plugin system consists of nearly 2000 eval statements sprinkled throughout the code, and eval is not supported by hiphop.
That's probably only the tip of the iceberg, when it comes to getting vbulletin to compile.