Wednesday, April 11, 2012

The Hacker Way at Facebook

Have you ever wondered why Facebook changes seem to propagate almost haphazardly? It's because the underlying source code gets distributed to all of Facebook's servers via BitTorrent.
Because Facebook's entire code base is compiled down to a single binary executable, the company's deployment process is quite different from what you'd normally expect in a PHP environment. [Chuck] Rossi [lead release engineer] told me that the binary, which represents the entire Facebook application, is approximately 1.5GB in size. When Facebook updates its code and generates a new build, the new binary has to be pushed to all of the company's servers.
Moving a 1.5GB binary blob to countless servers is a non-trivial technical challenge. After exploring several solutions, Facebook came up with the idea of using BitTorrent, the popular peer-to-peer filesharing protocol. BitTorrent is very good at propagating large files over a large number of different servers.
Rossi explained that Facebook created its own custom BitTorrent tracker, which is designed so that individual servers in Facebook's infrastructure will try to obtain slices from other servers that are on the same node or rack, thus reducing total latency.
This strategy explains why there is almost no downtime for Facebook's users and why some people get the new feature and gui changes before others do, instead of all at the same time. But no, this does not explain why I have not changed over to the new Timeline interface yet!

(via GeekPress)