Keep streaming when your origin fails

A default Adaptive Media Delivery environment has exactly one origin. If it stops responding, playback stops. Origin failover lets you switch to a backup origin mid-session, or return a specific HTTP status code to the client, when the primary origin times out or returns particular status codes.

It's built on Mixed Mode Configuration and is available to all Adaptive Media Delivery customers — no contract addition needed.

When to use this

  • You run live events where an origin outage is a visible, expensive failure.
  • You already maintain a second origin, or can produce one.
  • You can keep content synchronized between the two. This is the hard part, and it's a prerequisite rather than a nice-to-have.

Before you begin

Supported backup origin types

  • Custom (Your Origin)
  • NetStorage
  • Media Services Live

Synchronize your content — this matters

To fail over mid-playback, segments have to be interchangeable between origins. "Synchronized" here means a segment can come from either origin without upsetting the player's decoder. Switch from content A on the primary to content B on the backup and the decoder may choke, producing playback errors.

Segments on both origins need to be binary-identical or time-aligned. Three ways to get there:

  1. Use a single encoder that posts the same segments to both origins.
  2. Use a single encoder posting to the primary, then archive those segments from the primary to the backup.
  3. Time-align two encoders and ingest servers — same UTC time, same timestamps inserted into the chunks.

For live with multiple encoders, synchronize them using whatever method the vendor requires. On-demand is usually simpler: encode once and push identical copies to both origins.

1 - Set up your primary origin

Nothing special here. The Origin Server behavior in the default rule set is your primary origin, exactly as in any Adaptive Media Delivery environment. See Prepare your origin server.

If you're using Media Services Live, read Media Services Live caveats before you go further.

2 - Configure the recovery methods

Add the Origin Failure Recovery Methods rule. It carries two sub-rules, one per recovery method:

  • Failure Recovery Method1 — configures a backup origin.
  • Failure Recovery Method2 — configures a specific HTTP status code returned to the client.
🚧

Two structural rules about this rule

You can't add match criteria or behaviors directly to Origin Failure Recovery Methods — all configuration happens in its two sub-rules. And it has to be the last rule in the rule tree, so its recovery methods aren't overridden by anything below it.

Failure Recovery Method1 — the backup origin

  1. Select the Failure Recovery Method1 sub-rule.
  2. In Criteria, set the drop-down to Recovery Configuration Name and enter a unique identifier: 3 to 20 capitalized alphanumeric and dash characters, for example ALT-ORIGIN. Record this value — you reference it from the policy later.
  3. Configure the behaviors:
BehaviorRequiredNotes
Origin Failure Recovery Method✓Set Recovery Method to Retry using Alternate Origin.
Origin Server✓The backup origin's details, configured as you would any origin.
Origin Characteristics✓Best-practice optimizations for access to the backup origin.
Modify Outgoing Request Path✗Optional URL rewriting before requests are forwarded to the backup.
🚧

Only these behaviors are allowed in this sub-rule.

Failure Recovery Method2 — the status code

  1. Select the Failure Recovery Method2 sub-rule.
  2. In Criteria, keep Recovery Configuration Name and enter a different unique identifier, for example STATUS-CODE-FAILOVER. Record this one too.
  3. In the Origin Failure Recovery Method behavior:
    • Recovery Method: Respond with a custom status code
    • Custom Status Code: the HTTP status code to send to the client when this method fires.

3 - Set up your recovery policy

The policy defines when failover triggers and which recovery method it uses. Add the Origin Failure Recovery Policy behavior and set it to On.

Where to put it

Anywhere that suits your match criteria — the default rule set if it should apply to all requests, or a custom rule set otherwise. Two constraints:

  • Not in the Origin Failure Recovery Methods rule. That rule supports no behaviors, and neither do its sub-rules beyond the ones listed above.
  • Not below the Origin Failure Recovery Methods rule, because that rule has to be last.

Tuning parameters

Optional settings that take a problematic origin out of rotation for a while.

OptionDescription
Enable IP AvoidanceExcludes an origin's IP addresses for a period after a number of failures. Requests then fail over to another IP on the primary origin; once all primary IPs are excluded, the recovery method configured for origin responsiveness monitoring applies. Strongly recommended alongside the origin responsiveness scenario — without it, you may not see the failover effect you expect. May not be supported with Media Services Live.
IP Avoidance Error ThresholdNumber of failures before an origin IP is excluded.
IP Avoidance Retry Interval (seconds)How long before a failed IP comes off the exclude list.
Binary Equivalent ContentEnables internal performance optimizations for binary equivalent content. Only use it if your content really is byte-for-byte identical across origins.

Failure scenario: origin responsiveness monitoring

Continuously monitors connectivity health to the primary origin. Enable Monitor Origin Responsiveness, then:

OptionDescription
TimeoutsThe threshold that triggers a retry or recovery. Choose a preset or User-Specified with your own value in seconds.
Enable Retry Before RecoveryRetry after a failure before invoking the recovery method. If Enable IP Avoidance is Off, leave this Off too — without IP avoidance, your failover method may not be used at all.
Enable Recovery MethodTurns on a recovery method for this scenario.
Recovery Method Configuration NameThe Recovery Configuration Name of the method you want: Method1 for a backup origin, Method2 for a status code.

The presets use segment-based logic with these defaults:

ThresholdSegment duration
Aggressive2 seconds
Moderate3 seconds
Conservative4 seconds

A request to your primary origin that meets or exceeds the threshold triggers the retry or recovery action.

📘

Presets want IP avoidance

For best results with the fixed thresholds, set Enable IP Avoidance to On and configure it.

Failure scenario: status code monitoring

Watches for specific origin status codes. There are three independent configurations so you can route different codes to different recovery methods.

Enable Monitor Status Codes in Status Code Monitoring: Configuration 1, then:

OptionDescription
Response CodesOrigin response codes that trigger this method. A single code (501), a range (501:504), or a comma-separated list (501, 503).
Enable Retry Before RecoveryRetry before invoking recovery. Note that a retry won't reach the origin if the initial error response was cached — 204, 305, 404, and 405 are typically cached, and you can add others via Cache HTTP Error Responses.
Recovery Method Configuration NameThe method to invoke.

Configurations 2 and 3 work identically, with one rule: you can't repeat status codes across configurations. A code used in Configuration 1 can't appear in 2 or 3.

Worked example: mixed failure scenarios

Timeouts fail over to a backup origin; specific error codes return a different status code to the client. This assumes the default layout — Method1 is the backup origin, Method2 is the status code.

Step 1 — origin responsiveness monitoring

OptionSetting
Monitor Origin ResponsivenessOn
TimeoutsA preset, or User-Specified with your own value
Enable Retry Before RecoveryYour choice
Enable Recovery MethodOn
Recovery Method Configuration NameAlt-origin — the name from Failure Recovery Method1

Step 2 — status code monitoring, configuration 1

OptionSetting
Monitor Status CodesOn
Response CodesThe origin codes you want to catch
Enable Retry Before RecoveryYour choice
Recovery Method Configuration NameStatus-code-failover — the name from Failure Recovery Method2

Optionally, step 3 — use Status Code Monitoring: Configuration 2 with a different set of codes and the Alt-origin recovery name, so some error codes fail over to the backup origin instead of returning an error.

Known issues

IssueDescription
Range requestsIf a transparent failover happens mid-sequence and the objects aren't binary identical, playback decoding may error. If you need range requests, either don't use the transparent failover recovery method, or guarantee binary-identical content across origins.
Content must be synchronizedSee Synchronize your content.
Large objects and partial object cachingWith partial object caching, failover is supported for the initial request but not for subsequent segment fetches.
Doesn't work with watermarkingCurrently incompatible. Expected to be fixed in a future release. See Trace leaked content with forensic watermarking.

Media Services Live caveats

Stream-level failover

Media Services Live traditionally fails over at the stream level — same domain, different path, with the stream ID suffixed -b:

  • Primary: https://customer.akamaized.net/hls/live/1234567/index_900.m3u8
  • Backup: https://customer.akamaized.net/hls/live/1234567-b/index_900.m3u8

In this arrangement:

  • IP avoidance can't be used. Primary and backup share an origin, which conflicts with origin failover. Leave Enable IP Avoidance off.
  • Dissimilar object names need advanced metadata. If primary and backup use different object names (primary/index_900.m3u8 versus backup/back_900.m3u8), the backup paths have to be rewritten. Talk to your account representative.

Origin and stream failover

Where a second hostname is assigned for the backup stream — a geo-diverse backup origin, for example — you get a genuinely distinct backup origin hostname:

  • Primary: https://baseballvids-xjp.akamaized.net/hls/live/2003458/baseballvids-xjp/index_900.m3u8
  • Backup: https://b-baseballvids-xjp.akamaized.net/hls/live/2003458-b/baseballvids-xjp/index_900.m3u8

Both the hostname and the stream ID differ, so:

  • IP avoidance can be used.
  • Dissimilar object names still need advanced metadata.

Related


Did this page help you?