Facebook Opens Live Commenting To AllFacebook Opens Live Commenting To All

A company engineer details the behind-the-scenes development challenges in creating the new instant messaging-like feature.

Alison Diana, Contributing Writer

February 8, 2011

4 Min Read
information logo in a gray background | information

Top 15 Facebook Apps For Business

Top 15 Facebook Apps For Business


(click image for larger view)
Slideshow: Top 15 Facebook Apps For Business

Facebook on Monday confirmed all users now have access to live commenting, a capability that allows accountholders to communicate in real-time.

First unveiled about two weeks ago, live commenting now gives Facebook users access to a more instant message-like experience within the social network. Users no longer must refresh their page to see if a friend has responded to a post; instead, comments appear as other users post them. The idea sounds simple: Execution, however, was not as easy as it appears, said Ken Deeter, a Facebook software engineer, in a company blog.

"This wasn't a small challenge: every minute, we serve over 100 million pieces of content that may receive comments. In that same minute, users submit around 650,000 comments that need to get routed to the correct viewers," he wrote. "To make this feature work, we needed to invent new systems to handle load patterns that we had never dealt with before."

At first, Facebook considered a poll-based approach that would periodically send a request to check whether new comments had arrived on pages with content that could be commented on, said Deeter. Although the social media giant could increase the polling frequency to approximate a real-time feel, the approach would not scale, he said.

"Because humans are so sensitive to latency in real-time communications, creating a truly serendipitous commenting experience requires comments to arrive as quickly as humanly and electronically possible," wrote Deeter. "In a poll-based approach this would mean a polling interval of less than five seconds (and that would still feel slow!), which would very easily overload our servers."

Instead, Facebook opted for a push-based approach, one that would let it know who was viewing each of the 100 million pieces of content per minute that the company serves, he said. And Facebook required a system that also could manage the rate at which this data changed -- up to 16 million new associations per second, Deeter noted.

Top 20 Apps For Managing Social Media

Top 20 Apps For Managing Social Media


(click image for larger view)
Top 20 Apps For Managing Social Media

By 2014, people are expected to send 128 billion IMs worldwide per day, according to estimates by the Radicati Group. This year, the research firm predicts, users will send 76 billion, compared with 60 billion in 2010.

Before adding live comments, Facebook's infrastructure optimized more reads than writes, he said. But now the company "flipped the game," said Deeter. Because of this messaging feature, each page-load needs multiple writes, and each write of a comment requires a read.

"We realized that we were building something that was fundamentally backwards from most of our other systems," he said. "At Facebook, traditionally, writes are applied to one database and asynchronously replicated to databases across all regions. A good way to think of this approach is 'read locally, write globally.' Because of our unique situation, we settled on the completely opposite approach: 'write locally, read globally.'"

To accomplish this, Facebook deployed distributed storage tiers that exclusively handle writes locally, then less frequently collect information from the company's data centers to create the final result, said Deeter.

When users load their News Feeds via Facebook's Virginia data center, the system writes to a storage tier within that data center, recording the fact that users are viewing specific pieces of content and pushes new comments to those accountholders, he explained. As friends input comments, Facebook fetches viewership information from all its data centers, combines that information, and then pushes out those updates.

"In practice, this means we have to perform multiple cross-country reads for every comment produced. But it works because our commenting rate is significantly lower than our viewing rate," Deeter said. "Reading globally saves us from having to replicate a high volume of writes across data centers, saving expensive, long-distance bandwidth." Other members of the Facebook engineering team included Prasad Chakka, Adam Hupp, Elliot Lynde, Chris Piro, Tom Occhino, and Tom Whitnah. The effort, which began at Hackathon, required constant coordination between Facebook's front- and back-end engineers, said Deeter.

This is not the first marriage of social media and instant messaging. In 2009, for example, Google unveiled Wave, a communication and collaboration system that aims to be "what e-mail might look like if it were invented today." The service -- which Google made widely available in May 2010 -- gave users real-time IM communication and asynchronous email messaging. After underwhelming response, Google nixed Wave in August 2010.

Read more about:

20112011

About the Author

Alison Diana

Contributing Writer

Alison Diana is an experienced technology, business and broadband editor and reporter. She has covered topics from artificial intelligence and smart homes to satellites and fiber optic cable, diversity and bullying in the workplace to measuring ROI and customer experience. An avid reader, swimmer and Yankees fan, Alison lives on Florida's Space Coast with her husband, daughter and two spoiled cats. Follow her on Twitter @Alisoncdiana or connect on LinkedIn.

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like


More Insights