A peek at the code behind Facebook

A developer has gathered a collection of source code snippets used by the social media giant

A man is silhouetted against a video screen with a Facebook logo
Credit: REUTERS/Dado Ruvic

About a year ago, I wrote about a snippet of Perl code that was purportedly from the early days of Facebook. If you like that sort of thing, then you’ll like what Nathan Malcolm has recently unearthed and blogged about. Malcolm, who runs Sinthetic Labs, found a number of code samples on Pastebin and also tracked down some command line output generated by engineers at the social media behemoth.

Among the interesting Facebook tidbits Malcolm found were:

  • Evidence that Facebook uses PHPUnit for unit testing. This is, in fact, the case or, at least, was the case a few years ago. Former Facebook engineer Steven Grimm confirmed that in a Quora answer in 2010. Grimm also shared a lot more information about the tools Facebook used at that time for automated testing, which also included Watir for browser-based testing, JSSpec for testing JavaScript code and JUnit for testing backend services.
  • Indications that Facebook has been using Mercurial as its version control system. Again, this is indeed the case. Facebook engineers Durham Goode and Siddharth Agarwal wrote earlier this year that Facebook used to use a Subversion server with a Git mirror, but, anticipating scaling problems with that approach, they’ve since switched to Mercurial. At that time, Goode and Siddharth claimed that Facebook had contributed over 500 patches to Mercurial to help improve performance and scalability.
  • Code samples or output related to their internal database Unicorn and Gatekeeper, which is the tool they use to roll out functionality to a subset of users. If you’d like to learn more about how Gatekeeper works, two years ago Facebook’s Girish Patangay talked about it in the video below (skip ahead to 11:35 in the video to hear him talk about Gatekeeper).
  • Apparently, at one point, one of Facebook’s MySQL passwords was “e5p0nd4”. Why would that be interesting? Because, Malcolm guessed, it might just be derived from the motto of Mark Zuckerberg’s fraternity at Harvard, Alpha Epsilon Pi, which is ESPONDA. While we’re on the subject of Mark Zuckerberg’s fraternity days, his nickname there was Slayer.

Fun stuff. Malcolm has made all of the code and output he found available for download at the bottom of this page if you want to poke around further. Have fun!

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon