Live-streaming applications require that streaming be uninterrupted and have minimal delays in order to deliver a quality experience to end users’ devices. Delays in rendering live streams can lead to poor video quality and video buffering, negatively impacting viewership. To ensure a high live-streaming quality, you need a reliable content delivery network (CDN) infrastructure.
Media CDN is a content delivery network (CDN) platform designed for delivering streaming media with low latency across the globe. Notably, Media CDN uses YouTube’s infrastructure to bring video streams (both on-demand video and live) and large file downloads closer to users for fast and reliable delivery. As a CDN, it delivers content to users based on their location from a geographically distributed network of servers, helping to improve performance and reduce latency for users who are located far from the origin server.
In this blog, we look at how live-streaming providers can utilize Media CDN infrastructure to better serve video content, whether the live-streaming application is running within Google Cloud, on-premises, or in a different cloud provider altogether. Media CDN, when integrated with Google Cloud External Application Load Balancer as origin, can be utilized to render streams irrespective of the location of the live-streaming infrastructure. Further, it’s possible to configure Media CDN so that live streams can withstand most kinds of interruptions or outages, to ensure a quality viewing experience. Read on to learn more.
Live streaming
Live streaming is the process of streaming video or audio content in real time to broadcasters and playback devices. Typically live-streaming applications, involve the following components:
Encoder: Compresses the video to multiple resolutions/bitrates and sends the stream to a packager.Packager and origination service: Transfers the transcoded content to different media formats and stores video segments to be rendered via HTTP endpoints.CDN: Streams the video segments from the origination service to playback devices across the globe with minimal latency.
Media CDN
At a high level, Media CDN contains two important components:
Edge cache service: Provides a public endpoint and enables route configurations to route the traffic to specific origin.
Edge cache origin: Configure a Cloud Storage bucket or a Google External Application Load Balancer as an origin.
The above figure depicts an architecture where Media CDN can serve a live stream origination service running in Google Cloud, on-prem or on an external cloud infrastructure, by integrating with Application Load Balancer. Application Load Balancer enables connectivity to multiple backend services and provides advanced path- and host-based routing to connect to these backend services. This allows live stream providers to use Media CDN to cache their streams closer to the end users viewing the live channels.
The different types of backend services provided by Load Balancers to facilitate connectivity across infrastructure are:
Internet/Hybrid NEG Backends: Connect to live-streaming origination service running in a different cloud provider or on-premises.Managed Instance Groups: Connect to live-streaming origination service running in Compute Engine across multiple regions.Zonal Network Endpoint Groups: Connect to live-streaming origination service running in GKE.
Disaster recovery (Primary/Failover Origins)
Since any disruption to live stream traffic can affect viewership, it is essential to plan for disaster recovery to protect against zonal or regional failures. Media CDN provides primary/secondary origin failover to facilitate disaster recovery.
The above figure depicts Media CDN with an Application Load Balancer origin providing failover across regions. This is achieved by creating two “EdgeCacheOrigin” hosts pointing to the same Application Load Balancer with different “host header” values. Every EdgeCacheOrigin is configured to set the host header to a specific value. The Application Load Balancer performs host-based routing to route the live stream traffic requests based on the host header value.
When a playback device requests the stream from Media CDN, it invokes the Application Load Balancer by setting the host header to the primary origin value. The load balancer looks at the host header and forwards the traffic to the primary live stream origination service. When the primary live stream provider fails, the failover origin rewrites the host header to the failover origin value and sends the request to Application Load Balancer. The load balancer matches the host and routes the request to a secondary live stream origination service in a different zone or region.
The below snippet depicts the URL host-rewrite configuration in the EdgeCacheOrigin:
Conclusion
Media CDN is an important part of the live streaming ecosystem, helping to improve performance, reduce latency, and ensure quality for live streams. In this post, we looked at how live stream applications can utilize Google Media CDN across multiple environments and infrastructure. To learn more about Media CDN, please see:
Deploy Streaming Service with Media CDNMedia CDN OverviewMedia CDN with Application Load Balancer
Cloud BlogRead More