I am trying to quickly learn some of the underlying technology behind HDS and HLS live streaming.
I have set up Wowza Media server 3.5 on a Amazon WebServices instance in EC2 and distribute through CloudFront. I did my first live event and was watching my server load creep higher and higher. I was wondering if anyone could help me understand some of the underpinnings of HDS/HLS live streaming (and nDVR...):
- Wowza is the origin server for my cloudfront distribution
- HDS manifest file is set to cache for 2 seconds in CF (TTL time)
- I checked all the IPs hitting my Wowza Instance, they appeared in fact to be CF caching locations, or edge servers
- (assumption) Since all HDS traffic is over port 80, all video content ends up being cached at the edge locations (albeit for 2 secs)
Here's where my question comes about: how data is served for video content (here's my understanding, please set me straight!): - When a viewer requests a playlist or mainfest file, they get XML back which points the player to a chunk of video/audio (m4fa and m4fv within the DVR application instance?) data that they need to play next. Since this data is also delivered over port 80, it is cached as well.
If the above statements are correct, then does the following make sense for optimization for HDS and HLS:
Case 1: DVR service: I set the rules for caching in CloudFront as follows:
- anything ending with "f4m", "m3u8", and "?DVR" to cache for 2 seconds (the playlist/manifest files)
- the default for everything else should cache for longer (perhaps an hour, or 24 hours...?) This way, the DVR data remains cached but the playlist keeps updating every 2 seconds
Case 2: No DVR service (is this the better way to optimize?)
- I suspect we could optimize server load as well by killing the DVR service all together, this way all data distributed through CF is just the most recent audio/video packets - therefore all viewers should be requesting the same playlist and data files, and thusly a large amount of people requesting those files is no big deal since my server is only getting hit every 2 seconds from each edge location to update the manifest files).
- If this the media file chunks are given a longer caching time, would it matter if we killed the DVR service if the media remains cached?
Thanks for any insight you can offer!