After borrowing Facebook open source code for running PHP programs more efficiently, Etsy won’t need to grow its data center footprint this year, saving it from a significant expense.
By using Facebook’s HHVM (HipHop Virtual Machine) software, Etsy doubled the work of each server, eliminating the need to purchase new servers this year, according to Dan Miller, an Etsy software engineer.
That also means Etsy can hold off on procuring extra data center space, which is even more costly than new servers, said Miller, who described Etsy’s use of HHVM in greater detail in a blog post Monday.
With a user base of nearly 20 million, Etsy is a Web site devoted to selling craft items on behalf of more than a million merchants.
The site itself was built with PHP, a popular but somewhat chaotic Web programming language. As the company moved into the mobile space, it found its PHP-based codebase wasn’t as well suited for serving mobile clients in addition to Web clients.
Miller led an effort to test Facebook’s HHVM as an alternative to running PHP directly on its servers. Facebook created HHVM to speed up the execution of PHP code, which it needed to scale to serve its 1.4 billion users.
Using HHVM is superior to executing PHP natively in a number of ways, Miller said. HHVM recognizes when PHP code is being reused and can convert it into machine code to execute more quickly. “Now you can do the same thing with fewer CPU instructions than before,” Miller said. The Facebook team also optimized the way PHP handled common functions, such as the handling of arrays.
In initial tests, Etsy had found that most of its existing PHP code could run on HHVM without modification. In fact, it found HHVM could run the PHP code twice as quickly. It quickly rolled out HHVM and now uses the software to run nearly all its user-facing services.
The only limitation that Etsy found is that some extensions to HHVM, such as those for interacting with databases or to serve as a caching layer, may not be as robust as HHVM itself. Many were written by Facebook engineers to add on to HHVM once it went open source. They weren’t used in production by Facebook though, so they haven’t been battle-hardened, Miller said.
Companies as large as Facebook find it necessary to build infrastructure software such as HHVM because they can’t rely on “mainstream tools” to serve their massive client base, wrote IDC software development analyst Al Hilwa, in a new report on Facebook.
Releasing the software it developed in-house can help a company recruit top programming talent, as well as provide a way for the company’s coders to show off their work, Hilwa noted.
Etsy is not the only large-scale Internet service to shift to HHVM. Online storage provider Box and WordPress hosting provider WP Engine have both started using the technology as well.