How To Deliver Low-Latency HLS With Wowza and Google Cloud Media CDN
While achieving sub-second latency in a controlled lab environment is relatively straightforward, maintaining that performance at scale is more difficult. Traditional HLS (HTTP Live Streaming) is the industry workhorse for reliability and reach, but its reliance on large segment buffers introduces a lag that is unacceptable for real-time use cases.
Standard CDNs are frequently optimized for high-throughput, large-file delivery. When you introduce the tiny packages required for Low-Latency HLS (LL-HLS), these networks can struggle with cache efficiency and origin strain. By combining the processing power of Wowza Streaming Engine with the global edge presence of Google Cloud Media CDN, you can build a video infrastructure that scales horizontally without sacrificing responsiveness.
Architecture Overview: From Glass to Glass
Building a low-latency pipeline requires optimization for speed. This architecture relies on a tightly integrated technology stack designed to minimize the distance between the source and the edge.
1. The Source: High-Performance Ingest
The workflow begins with a high-quality encoder. This could be the open-source OBS software or a professional hardware appliance that pushes a stream via RTMP or SRT. While RTMP is common, SRT is increasingly preferred due to its ability to handle jitter and packet loss on the first mile ingest. This ensures the cleanest possible signal reaches the origin.
2. The Processing Engine: Wowza Streaming Engine
Wowza Streaming Engine acts as the central intelligence of this architecture. Its primary role is to ingest the source feed and transcode/transmux it into fragmented MP4 segments. Unlike standard HLS, which might wait for anywhere from 6 to 30 seconds of video to accumulate before creating a segment, Wowza is configured to generate much smaller chunks (often 500ms to 1 second). With LL-HLS, the manifest is updated more frequently, delivering chunks to the player before the segment is complete. Because of this, the player can start playing content sooner.
3. The Edge: Google Cloud Media CDN
Google Cloud Media CDN serves as the global distribution layer. It leverages Google’s extensive private fiber network and Anycast IP architecture, meaning users are always routed to the closest possible edge location. For LL-HLS, two features here are critical:
- Origin Shielding
This acts as an intermediate caching layer between Wowza Streaming Engine and the global edge. Instead of every edge hitting the Wowza server for the latest manifest or video chunk, they hit the Shield. This drastically reduces load on the origin and ensures that, even during massive traffic spikes, the server isn’t overwhelmed by requests for tiny segment files. - Flexible Cache Logic
Google Media CDN provides granular control over how long manifests (.m3u8) and segments (.cmfv and .cmfa for CMAF, or .ts for TS) are cached. By setting aggressive refresh rates for manifests, while maintaining longer cache lives for segments, the player always has the most recent live feeds while maximizing delivery efficiency.
This Encoder-to-Engine-to-Edge setup ensures that content is always moving, never sitting in a buffer longer than absolutely necessary.
Tuning the Origin with Wowza Streaming Engine
Transform Wowza Streaming Engine to go beyond default HLS settings. The goal is to minimize the size of your video data by breaking it into small, manageable chunks that can be processed and delivered with near-zero overhead.
Before applying custom tweaks, ensure your server is baseline-configured as an HTTP caching origin. Once the foundation is set, follow these specific steps to enable the Low-Latency HLS (LL-HLS) toolset.
1. Enabling the LL-HLS Packetizer
Add three custom properties to your application to instruct Wowza to prioritize low-latency delivery. To add a custom property in Wowza Streaming Engine, follow these steps:
- In the Wowza Streaming Engine Manager, select your application (e.g., live).
- Navigate to Properties and then click Custom in the upper navigation bar.
- Click Edit and select Add Custom Property.
Then, add the following three properties:
- Property 1: Enable Low Latency
- Path: Live Stream Packetizer
- Name: cmafLLEnableLowLatency
- Type: Boolean
- Value: true
- Property 2: Audio Chunk Duration
- Path: Live Stream Packetizer
- Name: cmafLLChunkDurationTargetAudio
- Type: Integer
- Value: 500
- Property 3: Video Chunk Duration
- Path: Live Stream Packetizer
- Name: cmafLLChunkDurationTargetVideo
- Type: Integer
- Value: 500
By setting these chunk targets to 500ms, you are drastically reducing the amount of data that must be buffered before it is sent to the CDN.
2. The Segment Duration Tweak
Even with LL-HLS enabled, the overall segment duration plays a role in end-to-end latency. Perform this timing adjustment to further reduce latency:
- Locate the existing CMAF packetizer configuration in your application settings.
- Change the existing segment duration value from the default 6000 (6 seconds) to 2000 (2 seconds).
- Save and Restart the application for the changes to take effect.
3. Securing the Stream
Before the content leaves your origin, its transportation path must be encrypted. For this workflow, use Wowza StreamLock to obtain a valid SSL certificate. When Google Cloud Media CDN fetches content from your origin, it will do so over a secure HTTPS connection.
Building the Edge with Google Cloud Media CDN
With your Wowza Streaming Engine origin tuned for speed, the next step is to configure the distribution layer. Google Cloud Media CDN is designed to fetch content from your origin and deliver it via Google’s global edge network. This process involves creating a dedicated origin service and an edge cache service with specific routing logic.
1. Creating the Origin Service
The Origin in Google Media CDN represents your Wowza Streaming Engine server. This is where the CDN will look to fetch manifests and segments.
- In the Google Cloud Console, go to Network Services > Media CDN and click the Origin tab.
- Click Create Origin, provide a name (e.g., wowza-origin), then select the IP and FQDN radio button.
- Enter Connection Details
- For Address, enter your Wowza server’s IP address or Fully Qualified Domain Name (FQDN).
- For Protocol, select HTTPS and set the port to 443. Note that you should use HTTPS instead of HTTP/2 when communicating specifically with the Wowza origin.
An optional, but recommended, step is to also configure failover. Here, you can specify a secondary origin, such as a Cloud Storage bucket, to maintain stream availability if the primary Wowza server becomes unreachable.
2. Configuring the Edge Cache Service and Route Rules
The Edge Cache service defines how traffic is routed and cached. For Low-Latency HLS, you need to establish a hierarchy of rules to handle manifests and segments differently.
- Go to the Services tab in Media CDN and click Create Edge Cache Service.
- Define the public hostname (e.g., cdn.your-domain.com) that viewers will use to access the stream.
- Route Rule 1: HLS Manifests (.m3u8)
- Priority: 100
- Match Condition: Select Path Template Match and enter /**.m3u8
- Route Action: Choose your Wowza origin
- URL Rewrite (Critical): If your origin expects a different Host header than your public CDN hostname, you must add a Host Rewrite to match your Wowza domain
- Route Rule 2: Video Segments (.ts or .cmfv and.cmfa)
- Priority: 200
- Match Condition: Select Path Template Match and enter /**.ts or /**.m4s
- Route Rule 3: Catch-All
- Priority: 999
- Match Condition: Use a Prefix Match with the value / to ensure all other traffic is routable
3. Advanced Actions: CORS and URL Rewrites
Because web players often reside on different domains than your CDN, you must implement a Cross-Origin Resource Sharing (CORS) policy to avoid playback failures.
In the relevant route rules (Manifests and Segments), expand Advanced Configurations and add a CORS Policy. Under Allowed CORS origins, you can enter * to allow all domains or specify your player’s URL (e.g., https://player.your-domain.com). It is best practice to add dynamic response headers, such as {cdn_cache_status}. This helps with real-time troubleshooting and to verify whether a request was a cache hit or miss.
4. Security: Attaching SSL Certificates
To serve traffic over HTTPS, you must attach an SSL certificate to your Media CDN service.
- Use Google Certificate Manager to create a Google-managed certificate with the scope set to Edge Cache.
- Add the provided CNAME record to your DNS provider to authorize ownership.
- Once the certificate status is ACTIVE, edit your Media CDN service, navigate to the Security section, and select your new certificate.
- Point your domain’s DNS A record to the Anycast IP address provided by the Media CDN service to begin routing traffic through the edge.
Optimization and Shielding
Setting up the route is only half the battle. To truly scale without blowing your budget or crashing your origin, you need to fine-tune how Google Cloud Media CDN caches your content. Maximize your cache hit ratio (CHR) and protect your Wowza Streaming Engine server from being overloaded.
1. Defining Cache Policies
Not all video files are created equal. Manifests (.m3u8) update every few seconds and need a short shelf-life, while segments (.cmfv and .cmfa) are immutable and should live on the edge for as long as possible.
- For Manifests: Set the cache mode to “Force Cache All” with a short Time-to-Live (TTL), such as 2 seconds. This ensures viewers always get the latest live point while preventing every single player request from hitting Wowza simultaneously.
- For Segments: Use a much longer TTL (e.g., 24 hours or more). Since the content of a segment never changes once it’s created, there is no reason to ever fetch it from the origin more than once.
2. Cache Key Optimization
By default, CDNs often include every query parameter in the cache key. If one user appends ?utm_source=twitter and another appends ?utm_source=email, the CDN treats these as two different files, resulting in two separate requests to your origin for the exact same video segment.
To fix this, configure your Cache Key Policy to exclude all non-essential query strings. This consolidates requests into a single cache entry, significantly improving performance and reducing egress costs from your origin.
3. Implementing Flexible Origin Shielding
In a global event, having hundreds of edge locations fetch the same 500ms segment from your Wowza Streaming Engine server can still create a massive traffic spike. Origin Shielding adds a dedicated caching layer between the edge and your origin.
- In your Media CDN service configuration, enable Origin Shielding.
- Select a Shield Region that is geographically closest to your Wowza Streaming Engine instance.
Now, when the first user in Tokyo requests a segment, the Tokyo edge fetches it from the Shield. When the next user in Osaka requests it, the Osaka edge pulls it from the Shield rather than going all the way back to your origin. This Shield protects your Wowza server from redundant traffic.
4. Connection Pooling and Timeouts
To maintain low latency, the connection between the CDN and Wowza must be kept warm. Ensure Connection Pooling is enabled so that the CDN doesn’t have to perform a new TCP/TLS handshake for every tiny segment fetch. Adjust Origin Timeouts to be aggressive. If a 500ms segment doesn’t arrive within 1–2 seconds, the connection should retry or fail quickly rather than hanging and depleting the player buffer.
Observability: Measuring What Matters
In a low-latency environment, visibility is the difference between a seamless stream and a frustrated audience. When you are dealing with 500ms chunks, you need to move beyond high-level uptime metrics and dive into granular, request-level data.
1. Leveraging Cloud Logging for Real-Time Analysis
Google Cloud Media CDN integrates natively with Cloud Logging, providing a goldmine of JSON-formatted data for every request. To get the most out of your logs, you should focus on three specific fields:
- proxyStatus: This tells you exactly why a request succeeded or failed (e.g., destination_unavailable or connection_refused).
- cacheId: This helps identify which edge location served the content.
- cdnCacheStatus: This monitors your Cache Hit Ratio. If you see HIT anywhere in the response, your file is cached. If you see frequent MISS or EXPIRED statuses for video segments, revisit your TTL settings in Section V.
2. The X-Request-ID Strategy
Troubleshooting a specific viewer’s playback issue can feel like finding a needle in a haystack. To solve this, ensure your player sends a unique X-Request-ID header with every request.
In Google Cloud Logs Explorer, you can filter by this specific header to see the entire lifecycle of a single user’s session. This spans from the initial manifest request to every subsequent segment fetch. With this insight, you can pinpoint exactly where latency spikes or 404 errors are occurring for that individual.
3. Monitoring Latency and Time to First Byte (TTFB)
Time to First Byte (TTFB) is your primary KPI. For LL-HLS, you want to see TTFB consistently under 100ms from the edge.
Set up a custom dashboard in the Google Cloud Console to track Egress Bandwidth, Request Count, and Origin Latency. Create an uptime check that pings your .m3u8 manifest. If the manifest fetch time exceeds a certain threshold (e.g., 500ms), trigger an automated alert to your DevOps team.
4. Verifying with curl
Before going live, use the command line to verify your headers. Run the following command against your CDN URL:
curl -I -H “User-Agent: Mozilla/5.0” https://your-cdn-url.com/playlist.m3u8
Look for the x-goog-cache-status header. On the first hit, it should be MISS; on the second, it should be HIT. If it remains MISS, your cache keys or origin headers are likely misconfigured.
Real-World Reliability with Wowza & Google
Engineering a low-latency HLS workflow is a game of inches. By combining Wowza Streaming Engine’s ability to generate ultra-short chunks with Google Cloud Media CDN’s global reach and origin shielding, you effectively remove the bottleneck between your content and your audience.
This architecture lowers your latency whether you are streaming to ten people or ten million. The combination of a tuned origin and an intelligent edge ensures that your live stream actually stays live. If you are ready to scale your video workflows, contact the Wowza Streaming Engine experts for a consultation today.