How does Facebook serve millions so fast? BigPipe

I was looking at some Facebook source today and I noticed the JavaScript code referencing something called BigPipe. My curiosity lead me to Googling “BigPipe” and I ended up learning a very interesting technique for web site optimization. What is BigPipe?

This is similar to the pipelining performed by most modern microprocessors: multiple instructions are pipelined through different execution units of the processor to achieve the best performance. – link

Facebook does a great job outlining their use of BigPipe and I even found the opensource project on github – check it out here. Check out some of their performance results using a traditional approach versus pipelining the content:

As most know, Facebook is mostly written in PHP. The open source project on gitHub has sample implementations also in PHP so it is very easy to follow.


7 thoughts on “How does Facebook serve millions so fast? BigPipe

  1. They forgot the best browser – Mozilla SeaMonkey – from the test, which I have especially found out to perform the fastest also with Facebook apps, like Mafia Wars.

    It is faster than any other web browser I have tried, and I tried them all. It may not have all the latest unofficial HTML5 tags, but since they are unofficial, I’m not so worried about that. It supports however everything what is official and certified by the W3C consortium.

  2. I think that’s just because people don’t test things in the depth and passion I do. People listen to other people’s reviews and base their decisions on that without trying it themselves. I read also reviews, but I test everything again from the blank table. Double verification is all I’m about.

  3. Hey Bob

    Ahh cool stuff, great find. I’d read a lot before about how they had split out data to separate servers and then load from each server dependent on datasets. Very very simple and cool. It’s good actually seein such in-normalised data being used – I guess we are used to that.

    I found myself laughing when rather than posting on Facebook you actually ‘found yourself looking at the source code’ haha. I guess it appeals to me as that’s the kind of thing I do all the time!

    Keep these posts coming. Very enjoyable!


  4. @Mika – I think you also have to test to the scope of your audience. For instance, in the enterprise I just don’t think you will ever see Sea Monkey rolled out. That is why most companies stick to testing the big three – IE, Safari, and FireFox.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.