HipHop VM on EC2 – “could not allocate 1210089471 bytes for translation cache”

Facebook Engineering recently made a press release regarding the HipHop project, HHVM is finally faster than the hiphop compiler. They also made a post about how to get WordPress running on HipHop Virtual Machine! This is a pretty big deal, after all, it’s estimated that over 20% of the sites on the web today are actually WordPress installations. It has been reported that HHVM yields a 2.7x speedup over the regular php interpreter. I found this pretty interesting because I try to get the most out of my EC2 Micro instance before I have to upgrade to a m1.small (After all, I still have 3 months in my micro instance EC2 free tier!).

I went ahead and followed the instructions on the hiphop-php.com blog post to see how easy it was to get started with HHVM. I started up a fresh EC2 Micro instance, Ubuntu 12.04 Precise. The WordPress core needs only about 5 lines changed by hand and it took 3 hours to compile the HHVM source. I go ahead and try to start up the HHVM binary and nothing happens. I turn off the daemon flag to see if any errors are thrown and I get hit with the following: “could not allocate 1210089471 bytes for translation cache”.

This means that HipHopVM requires 1.12 Gigabytes of memory to start-up, this is beyond what an EC2 Micro instance can offer. To test the result I went ahead and upgraded the instance to a m1.small, HHVM started up without a problem and WordPress was working perfectly.

I went ahead and checked the docs and source to see if there was a way to lower the size of this ‘cache’, from the looks of the source where this error is printed, the code relies on the memory being that exact size, so it is far from an easy thing to change.

HHVM is not for pushing tiny servers to their limits.