Mildly technical post here. If reducing dating site infrastructure costs and speeding up web pages doesn’t interest you, feel free to skip this.
Much of Facebook’s infrastructure runs on the PHP scripting language, which is slow because it needs to be compiled at runtime (oversimplification). Languages like c++ are much faster than PHP. The tradeoff is that they are more brittle, less people know how to program in c++ and a number of other issues such as complexity. Compare this to PHP, which can be tweaked, transformed and bug-fixed very quickly, and you’ll see why PHP us such a popular choice for web applications.
PHP’s CPU-intensive overhead is part of the reason why Facebook spent something north of $200 million on hardware infrastructure. Match may spend $15/million a year, as a comparison.
Scaling Facebook is particularly challenging because almost every page view is a logged-in user with a customized experience. When you view your home page we need to look up all of your friends, query their most relevant updates (from a custom service we’ve built called Multifeed), filter the results based on your privacy settings, then fill out the stories with comments, photos, likes, and all the rich data that people love about Facebook. All of this in just under a second.
Enter HipHop for PHP, an internal project at Facebook which has been under development for two years. In short, HipHop turns the flexible and programmer-friendly PHP into screaming fast c++ (oversimplification.) Why am I writing about this? Because Facebook saw a 50% reduction is CPU utilization when they used HipHop over traditional PHP.
Amazing that 90% of Facebook web traffic us served using HipHop, only six months after deployment.
HipHop will be released this evening on GitHub under the open source PHP license. Have at it and let me know what you think. I wonder which will be the first dating site to take advantage of HipHop?