When you have a website such as Facebook, with over 400 million users interacting with each other in clusters of mini social networks, improving the performance of webpages, from the point of view of users, becomes a very complex problem. Throw in the fact that Facebook now offers a real-time stream and there’s even more complexity. Still, two Facebook engineers have been instrumental in making the site twice as fast as it was six months ago, using a new internal system called BigPipe.
The system, developed over the latter half of 2009 (but based on even earlier performance improvement developments initiated in early 2008), uses a “divide and conquer” concept called Pagelets. A single Facebook web page is broken down into logical blocks called Pagelets. So for example, Status updates might be one Pagelet, the Suggestions block another, the Ad block yet another, and so on.
By improving the performance of each Pagelet and also determining the optimum display order of Pagelets, a user-centric metric known as TTI (Time-to-Interact) is improved. This metric combines three other metrics: network time, generation time and render time. The net result of improving Pagelet loading and applying an optimum ordering gives Facebook users the portions of web page content that they want to see, as soon as possible.
To give Pagelets better performance, Facebook engineers applied some or all of Steve Souder’s 14 rules for high-performance websites, as well as the metrics and improvements (video) discussed at a Velocity 09 talk by fellow Facebook engineers David Wei and Changhao Jiang. Part of the performance improvement is also due to a recent PHP extension from Facebook called XHP.
There are still improvements that Facebook will need to apply to keep their ever-growing user base happy, but at least conceptually it’s a step in the right direction.