Recently saw a good article here but it's more about prefetching / pre-warming pages. Here I just want to share one trick we used to help some of our customers warm up their video contents.
Unique Challenges for Video Contents Pre-warming
Compared with webpages, video contents are normally even more difficult to pre-warm, due to both the size of individual files and the large amount of files involved. Also, most synthetic / load test tools including Akamai Site Analyzer, Gomez, KeyNotes, BlazeMeter, and NetworkBench all have a specific limit of download sizes, be it 2MB, 4MB or higher upon requests through a customer care ticket.
Some of our customers used to implement their own scripts on some cloud service providers to pull a list of their 'important videos' as a pre-warm or pre-load practice but apparent not all customers have this luxury resource of both cloud servers and technical know-hows to script those pre-warmings by themselves. The proposed solution discussed here is relatively easier to implement for normal customers with limited traffic cost and configuration overheads.
Assumptions & Prerequisites
For most of the video delivery configured at Akamai, we assume:
- Range requests are supported, both on Akamai and on origin
- Partial Object Caching is enabled and there are some level of fragment prefetches already enabled. For instance, if only the first a few bytes of a certain video file is requested, the first 'chunk size' (normally 2MB) will be requested from origin if it's not in cache.
How it works
Although not many, there are still some works need to be carried out at both Akamai and customer side for this proposed solution to work, including:
- Akamai solution architect to create a configuration capable of serving URLs with a special query argument specifying the requesting size. This is normally done through translating this incoming query argument into a Request Header. For instance, http://download.customer.com/path/file.mp4?range=0-100 will be translated into http://download.customer.com/path/file.mp4 with a Http header of 'Range:bytes=0-100'
- Akamai solution architect to create a configuration with basic page prefetching capabilities to preload embedded image files
- Akamai solution architect to ensure the video files are configured as prefetcheable, for the sample we used here, files with an extension of 'mp4' need to be added to the prefetcheable list.
- Customer to create a simple Html page (with the below template) and use any synthetic / load testing tools to pull regularly. If the amount of prefetcheable video contents are big, can also include some random picking logic so that each time this page is requested, a different subset of video files are populated into the below img tags :