Video Streaming: Can Your Infrastructure Handle It?
Since going live, Facebook has doubled its video views to about 8 billion per day. And according to Social Media Today, the platform’s users stay engaged with live videos three times longer than on-demand videos.
While not every business is supporting 8 billion users a day, considering Facebook’s infrastructure and architecture innovations can offer insights into what your organization needs to succeed at live streaming. Because Facebook doesn’t yet provide a way to monetize live video through their content delivery network (CDN), if you want to make revenue from broadcasts, it’s time to develop your own video streaming infrastructure.
Live Video Has Different Traffic Patterns
In a live talk, Federico Larumbe, a member of the Facebook traffic team, says the social networking site sees a sharp initial spike in requests for content as video creators notify fans when live video is available. These traffic spikes — or “the thundering herd,” as Larumbe calls them — disrupt caching and load balancing. To handle demand, Facebook developed the following architecture to support its process:
- Broadcasters start recording live video, sending an RTMP stream to a live transcoder. Adaptive encoding helps Facebook adapt to available upload bandwidth, even when there’s insufficient bandwidth for a 500 kilobytes-per-second standard-definition video.
- The live transcoder decodes the video, transcoding it to multiple bit rates and creating a set of continuous, one-second MPEG-DASH segments for each bit rate.
- Orchestrated by automated network management tools, the MPEG-DASH segments are sent via HTTP to a cache in the data center. From there, multiple cache segments are sent to points of presence (PoPs) all over the globe.
- Each PoP has two layers: HTTP proxies and cache. Different segments are stored in different caches, which helps with load balancing. A globally distributed load-testing service gives Facebook the ability to overload PoPs — up to 10 times production loads — when necessary.
- Viewers receive notification about the live video, and their device starts fetching one segment per second from the nearest available PoP cache.
How Video Streaming Scales
In addition to the multiplier effect provided by sending segments copied to PoP caches and proxies, Facebook uses a process called “request coalescing” to reduce request volume on the network. If a segment isn’t available in the PoP cache, instead of sending every viewer request back to the data center cache, Facebook only sends the first viewer request. When the segment returns from the data center cache, it’s fulfilled for all viewers by the PoP cache.
Although viewers are waiting on one cache host for their segment, only the first request to the HTTP proxy actually goes through to the cache. Once the segment is accessed, the proxy fulfills all subsequent requests.
Predicting Traffic Volume
Instead of reacting to traffic, Facebook uses an interpolation function to anticipate viewer demand for every live video. Based on whether the first derivative is positive or negative, Facebook determines if the overall load is going up or down. The second derivative measures acceleration — whether speed is increasing or decreasing.
Together, these measurements help Facebook direct traffic to the closest available PoPs that can manage the load required to deliver a smooth video experience. Going predictive eliminates delay but also requires additional resources for running predictive analytics in the background.
What You Need When on Location
Some live streams are simple and require nothing more than a smartphone and a mic to capture audio. But if you’re live streaming from a stadium, like a live pay-per-view sports event, you’ll need more than just a solid CDN. You’ll also need sufficient upload bandwidth to deliver video to your CDN.
Depending on how much revenue your broadcast can generate, consider using a dedicated network to avoid competing for scarce bandwidth. A networking services provider can help you choose or build the right CDN and on-site network for live video streaming.