Every Millisecond Counts

Zizhuang Yang

Site speed has always been an important factor in the development of Facebook, even as the site evolves over time to become more feature-rich and complex. As we grow beyond the 250 million user mark, every small change to the site causes a huge ripple, affecting throngs of web surfers and their experience on Facebook. My project this summer as an engineering intern on the Infrastructure team involved tackling this imposing fact by exploring data and finding out how various changes to fundamental parts of the user experience impacted and changed user behavior.

Over this summer, I conducted a variety of experiments on sample tests of users, tweaking subtle parts of the site for each experimental group to investigate some of the questions often posed within Facebook as theories and hypotheses. For example, what exactly is the user behavior effect of a slower site or of one perceived to be faster? How do usage and interaction patterns change when these factors change? What about the number of stories we show in News Feed -- what's the performance vs. usage exchange there? How about the appearance of a page while it's loading? How does a user who casually uses Facebook become affected by certain site changes compared to a user who uses Facebook many times throughout their day? These questions and more are what I sought to answer through experimentation and data.

Here are a few learnings I found during my research:

  • Site Speed What happens to user behavior when we tweak the site to be slower in various degrees for them? It turns out that over a large gradient of site slowdowns, users in general spend around the same amount of time on Facebook, as measured by session time (user activity up until a certain period of idleness). Logically, page views suffer as a result. If pages take longer to load but people still spend the same amount of time on Facebook, then the number of page views is inversely proportional to the page loading time. On the other side of the coin, it means that since people tend to spend the same amount of time on Facebook, improving site speed would allow them to explore much more content and discover more of the network around them each visit.
  • Page Loading Another debate within Facebook pitted two loading schemes against each other. The debate was over whether or not we render the page as soon as possible. This runs the risk of showing users links and content that they won't get a response from until the interaction scripts load -- an experience some employees claim to be potentially infuriating. An alternative is to show nothing until the JavaScript is primed to load, and then to render everything at once. That way, the page appears to load really quickly, and the content is interactive almost immediately after rendering. I ran tests for groups of users, comparing one scheme against the other with the effect amplified to see the results. In all groups of users, keeping the page blank resulted in lower usage statistics. Thus the debate was resolved.
  • Scroll Loading A while back, some clever engineers at Facebook tackled the site speed problem on News Feed in an interesting way. We showed 30 stories in the News Feed, but when users loaded the home page they seldom saw more than 10. Since loading stories was a significant time expense in loading the page, the concept of scroll loading was introduced -- loading 15 stories when the page is loaded and then loading the other 15 (through an Ajax hook) when the user had scrolled down far enough to need 15 more stories.

The home.php load time was reduced and the user experience wasn't harmed. It was a good gain for us. But this concept had more potential in it. If people didn't mind the time delay as stories loaded when they scrolled down, what if we took this opportunity to show them more stories in the News Feed? One would point to the 'Older Posts' link for that purpose, but the link often went unloved - perhaps because people thought of it as a stopping point or because people simply didn't notice it at all. I performed an experiment gauging user behavior when we showed 30 more stories once a user scrolled down instead of 15 (bringing the total to 45), and the results were very encouraging: usage statistics rose across the board for many pages.

For the casual users who made up the bottom 25 percent of usage statistics, we saw a gain of over 20% in page views and time spent. This was a huge win, especially for the casual users who we have a hard time engaging. Soon after, the scroll-loading paradigm was changed to load 30 stories. It's not often that research bears fruit this quickly. All of these important conclusions from the data I collected were just a part of the exciting work that I've done this past summer during my internship at Facebook. There are always more theories to confirm, more details to find and more variables to optimize -- and there's nothing better than the quick hard facts to answer the questions that they bring.

Zizzy is back to school as a Junior in Carnegie Mellon University and already missing his summer.

Keep Updated

Stay up-to-date via RSS with the latest open source project releases from Facebook, news from our Engineering teams, and upcoming events.

Subscribe
Facebook © 2017