Origin-assist prefetch
With this prefetching method, when Akamai fetches an object from an origin, the response includes a new header that lists the next object in the sequence. Akamai can read this information and prefetch this object.
Basically, Akamai relies on assistance from your "intelligent" origin to trigger prefetching.
How it works
-
The media player makes a request for
{object-1}
. -
AMD handles the request by forwarding it to your origin.
-
Your origin returns the requested object,
{object-1}
, back to AMD.- The origin response also includes headers to prefetch
{object-2}
. The value of this header is either an absolute URL path or a relative URL path that's relative to{object-1}
.
- The origin response also includes headers to prefetch
-
AMD returns
{object-1}
to player and this completes the request/response flow for{object-1}
. -
Since the response from your origin also included prefetch response headers for
{object-2}
, AMD triggers prefetching.- AMD creates an HTTP/S request for
{object-2}
and forwards it to your origin. This is called a "prefetch request." AMD includes a preconfigured request header in it, that tells your origin that it's a prefetch request.
- AMD creates an HTTP/S request for
-
Your origin returns
{object-2}
to AMD.- The origin response could include a response header to prefetch
{object-3}
to continue the prefetching process.
- The origin response could include a response header to prefetch
-
AMD caches
{object-2}
.- AMD doesn't trigger prefetching for
{object-3}
. This is because{object-2}
was already prefetched from your origin (and you don't want a never-ending recursive prefetch cycle).
- AMD doesn't trigger prefetching for
-
The player makes a request for
{object-2}
. -
AMD fetches
{object-2}
from its cache and returns it in the response to the player.- If the origin response for
{object-2}
included prefetch response headers for{object-3}
, AMD triggers prefetching of{object-3}
, and the process can continue.
- If the origin response for
What's supported
Streaming Formats |
|
Live or Video on Demand (VoD) | Both |
Origin Server | There may be limitations on use for certain Origin Types when setting up the Origin Server in your property:
|
About the HLS stream
This discusses the object types you can usually find in an HLS stream, and the order they're presented in a request.
Object | What's triggered next in a prefetch | Additional details |
---|---|---|
Master Playlist (.m3u8) | One or more variant Playlists (.m3u8). | N/A |
Variant Playlist (.m3u8) | One or more segments belonging to the current variant playlist. The segment to prefetch depends on the play position of the player, and this can be difficult to determine for a VoD stream. For Live streams, this is typically one of the last three segments in the variant playlist. | For the typical HLS stream, segments have the following extensions:
For the newer HLS streams with CMAF segments, the extensions are:
|
Variant Playlist (.m3u8) | Zero or one | The
|
Segment | The segment that follows next in the video/audio/subtitle presentation time. | N/A |
About the DASH stream
This discusses the object types you can usually find in a DASH stream, and the order they're presented in a request.
init
segments for audio and video followed by actual audio and video segments. Unlike HLS, there are no bit rate-specific playlists, and content is always demuxed, so right after fetching the MPD file, the player typically requests two segments: one for video and another for audio.
Object | What's triggered next in a prefetch | Additional details |
---|---|---|
Manifest File (.mpd) | N/A | |
Init segment | One or more content segments. | N/A |
Segment | The segment that follows next in the video/audio/subtitle presentation time. | N/A |
1. Set up your origin
Akamai sends specific information to your origin to initiate prefetching. Your origin needs to include a properly formatted response header after this request, to trigger prefetching. review these sections to understand the flow of prefetching.
i. Akamai tells your origin prefetching is enabled
Akamai handles a player request for content and sends a prefetch request header to your origin, telling it that prefetching is enabled:
CDN-Origin-Assist-Prefetch-Enabled: 1
ii. Your origin responds to Akamai with what to prefetch
Your origin needs to use the Akamai request header to trigger prefetching. Your origin must send a prefetch response header that tells Akamai what should be prefetched. This response header must be comprised of the absolute or relative path to the object to be prefetched, followed by the Content-Length
header stating the length of the complete prefetch response header.
CDN-Origin-Assist-Prefetch-Path: <absolute|relative path of prefetch-able object's URL>
Content-Length: x
Akamai creates the full URL for the object to be prefetched by using:
- The player-requested URL of the current object, and
- The relative or absolute path listed in the prefetch response header.
Absolute path examples
Specify an absolute path by prefacing it with forward-slash (/"///"). This tells Akamai to use the exact path specified.
URL of player that initiated the request | Value of the response header from the origin that's used to trigger prefetch | URL of a request prefetched from <> |
---|---|---|
|
|
|
|
|
|
In these examples, both
property-hostname
andproperty-hostname-from-player
are the HTTP/1.1 "Host" header as seen by Akamai.
Relative path examples
Specify a relative path by leaving out the forward-slash (/"//") from the beginning of the path. Akamai uses the forward path of the current request, minus the filename as the base path when creating the prefetch URL path.
URL of player that initiated the request | Value of the response header from the origin that's used to trigger prefetch | URL of a request prefetched from <> |
---|---|---|
|
|
|
|
|
|
In these examples,
property-hostname
is the HTTP/1.1 "Host" header as seen by Akamai.
Example 1: Include a single "prefetchable" path per response header
The origin uses individual instances of the prefetch response header to include a single object to be prefetched.
CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8
Content-Length: x
If multiple objects are to be prefetched, then one response header per prefetchable URL can be returned by origin. Ensure that all response headers use the same name. The order of these headers determines the order Akamai follows to request each object.
CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8
CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/audio/pl.m3u8
Content-Length: x
Middle-layer proxies may not preserve this ordering of response headers, and content may not be delivered in the desired order.
Example 2: Include multiple "prefetchable" paths in a single response header
The origin uses a single instance of the prefetch response header to include a comma-separated list of multiple objects to be prefetched.
CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8,/hls/live-streaming/fifa/france-croatia/audio/pl.m3u8
Content-Length: x
The order of the paths listed determines what is prefetched first. Since this is only a single response header, the issue with middle layer proxies doesn't apply.
iii. Akamai requests the prefetched object for the player
With a "prefetch object" determined by the response header from your origin, Akamai requests it, as if it was requested by the player. To allow your origin to differentiate a prefetch request from a regular request all prefetch requests from Akamai use the same request header:
CDN-Origin-Assist-Prefetch-Request: 1
Once Akamai receives the prefetch object, it caches it until the player requires it.
Along with sending the prefetch object to Akamai, you can also have your origin send a new response header to prefetch the next object in the queue, if applicable.
2. Add Segmented Media Streaming - Prefetch
Add this behavior to your AMD property by performing the following:
-
Create a new AMD property, or edit an existing one using Property Manager.
-
In the Property Configuration Settings options, click Add Behavior.
-
In the Search available behaviors field, input Segmented Media to filter the listed behaviors, and select Segmented Media Streaming - Prefetch from the list.
-
The new behavior is added to your configuration. Set the Enable Origin-Assisted Prefetch switch to On.
Caveats on use
If you're also using Common Media Client Data for segment prefetching, its settings will override origin-assist prefetching.
Updated 9 months ago