Sunday 20 July 2014

HHVM and MongoDB

Just latley I have been playing with HHVM (HipHop) and MongoDB. To set the scene, we have a largish application written in PHP/Zend/MongodB that we would like to make faster. It has two main parts to it, a bunch of backend scripts called from crons, and the web application itself.
I recently got involved in an effort to produce a pure PHP MongDB driver, for the purpose of allowing servers which dont allow extentions to be loaded to interact with hosted MongoDB services such as MongoHQ, and beable to use MongoDB with HHVM.
The resulting driver is very complete, and implements a large subset of the Official PHP drivers support, in an dropin compatable fashion. You can see the php driver at https://github.com/mongofill/mongofill . Great as it is, there is an even better vertsion at https://github.com/mongofill/mongofill-hhvm which compiles the php driver alongside a "C" implementation of a BSON reader/writer to produce a loadable extension module for HHVM. And the results are fantastic. Our backend scripts are by no means simple Mongo/PHP code. But I was able to get them all working well with minor changes to the code. A testiment to the diligence of the Mongofill authors.

Posted via Blogaway4

No comments: