§2.6.1–2.6.3Internet Video · DASH · Content Distribution Networks

Application layer Kurose & Ross pp. 143–148 · ~16 min read

  • streaming stored video
  • http streaming
  • dynamic adaptive streaming over http
  • manifest file
  • content distribution network
  • enter deep
  • bring home
  • cluster selection strategy
  • pull caching

Where you are

  • Application layer you are here
  • Transport layer
  • Network layer
  • Link layer
  • Physical layer

Video is 80 % of Internet traffic. It is stored at several qualities and served from machines placed as close to you as the operator can afford. DNS (Domain Name System) is what quietly steers you to one of them.

Words you will meet

  • Streaming stored video — watching a recorded video while it is still arriving.
  • HTTP (HyperText Transfer Protocol) streaming — storing the video as an ordinary file and fetching it with a normal request.
  • DASH — Dynamic Adaptive Streaming over HTTP: several qualities, chosen chunk by chunk.
  • Manifest file — the list telling the player which versions exist and where each one is.
  • CDN — Content Distribution Network: servers spread worldwide, each holding copies.
  • Enter deep — many small clusters inside access ISPs.
  • Bring home — a few large clusters at exchange points.
  • Cluster selection strategy — the rule a CDN uses to pick which cluster serves you.

Why this matters

By many estimates streaming video accounted for about 80 % of Internet traffic in 2020. This is the largest single thing the Internet carries, and this section is how it is done.

It is also where several earlier results are cashed in at once. The bottleneck link from §1.4.4 explains why a distant data centre fails. Web caching from §2.2.5 is what a CDN scales up. DNS from §2.4 is the mechanism that steers you. Nothing here is new machinery — it is the previous four sections, combined.

What video costs

In streaming stored video the medium is prerecorded — a film, a television programme, a sporting event, a user’s own upload. It sits on servers, and users request it on demand.

A video is a sequence of images displayed at a constant rate, typically 24 or 30 images per second. An uncompressed image is an array of pixels, each encoded into bits for luminance and colour.

The important property is that video can be compressed, trading quality against bit rate. Today’s off-the-shelf compression algorithms can compress a video to essentially any bit rate you want. The higher the rate, the better the image and the better the viewing experience.

What video costs, in bits per second
What that means

Cells marked ⓘ have an explanation — click to read it. Sortable columns have a ↕ in the heading.

Compression can hit essentially any rate you ask for. The question is what quality comes with it.

The one measure that matters

From a networking point of view the salient characteristic of video is its high bit rate. And by far the most important performance measure is average end-to-end throughput.

In order to provide continuous playout, the network must provide an average throughput to the streaming application that is at least as large as the bit rate of the compressed video.

That is a hard constraint, not a preference. A buffer can absorb variation in when bits arrive. No buffer can supply bits that never arrived at all.

Compression can also produce several versions of the same video, each at a different quality. The book’s example is three: 300 kbps, 1 Mbps and 3 Mbps. A user on a fast connection might choose the 3 Mbps version; a user watching over 3G on a phone might choose 300 kbps.

HTTP streaming, and its one big flaw

In HTTP streaming the video is simply stored at an HTTP server as an ordinary file with a specific URL (Uniform Resource Locator) . The client opens a TCP (Transmission Control Protocol) connection and issues a GET for that URL. The server sends the file as quickly as conditions allow.

On the client side the bytes collect in an application buffer. Once the number of bytes there passes a threshold, playback begins: the application periodically takes frames from the buffer, decompresses them and displays them. So the video plays while later parts of it are still arriving.

This has been extensively deployed — YouTube used it from its inception. It also has a major shortcoming:

In plain words

All clients receive the same encoding of the video, despite the large variation in throughput available to different clients, and to the same client over time.

Choose a high rate and everyone on a slow connection is unable to watch. Choose a low rate and everyone on a fast connection watches a worse picture than they could have had. There is no setting that is right for everybody.

DASH

Dynamic Adaptive Streaming over HTTP ( DASH (Dynamic Adaptive Streaming over HTTP) ) removes the choice by not making it once.

The video is encoded into several versions, each with a different bit rate and quality. Each version is stored at the HTTP server under its own URL. The server also holds a manifest file , giving a URL for each version along with its bit rate.

The client requests the manifest first and learns what exists. It then selects one chunk at a time, each a few seconds of video, by giving a URL and a byte range in an HTTP GET request. While downloading, it measures the throughput it is receiving and runs a rate determination algorithm to choose which version the next chunk should come from.

What you actually get to watch, against the throughput you have
0.0009001800270036000.00010002000300040005000available end-to-end throughput (kbps)bit rate actually played (kbps)below this, nothing is playable at all

At 5000 kbps (move the pointer over the plot to read it anywhere):

  • DASH — picks the best version it can sustain:3000 kbps
  • Plain HTTP streaming — one encoding for everybody:1000 kbps

The book’s three versions: 300 kbps, 1 Mbps and 3 Mbps. Drag the single-encoding rate and watch where that flat line stops existing — below its own rate there is no playback at all.

Read the red line carefully

The dashed line is plain HTTP streaming with a single encoding. Below its own rate it does not exist — the curve lifts off the plot, because there is no playback at all, not merely worse playback.

The DASH staircase never does that until throughput falls below the lowest version. That is the whole gain, and it is a change in kind rather than degree.

Two things follow, and the book states both. DASH lets clients with different access rates stream at different rates. And it lets one client adapt over time as its available throughput changes — which matters especially for mobile users, whose conditions shift as they move between base stations.

Content distribution networks

Video companies distribute on-demand multi-megabit streams to millions of users every day. YouTube alone has a library of hundreds of millions of videos and serves hundreds of millions of streams daily.

The obvious approach is one massive data centre holding everything. There are three major problems with it.

Why the single data centre fails

  1. Distance. If the client is far away, packets cross many links and probably several ISPs, possibly on different continents. Suppose any one of those links has a throughput below the video’s consumption rate. Then the end-to-end throughput is below it too, because §1.4.4 showed throughput is governed by the bottleneck link. The more links in the path, the more likely one of them is slow, and the result is freezing.
  2. Repetition. A popular video is sent many times over the same links. That wastes capacity, and the video company pays its provider ISP for sending the same bytes into the Internet over and over.
  3. A single point of failure. If the data centre or its links go down, no video can be distributed at all.

So almost all major video-streaming companies use a content distribution network ( CDN (Content Distribution Network) ). A CDN manages servers in multiple geographically distributed locations and stores copies of videos and other content there. It then tries to direct each user request to the location that will give the best experience.

A CDN may be private, owned by the content provider itself, as Google’s is for YouTube. Or it may be third-party, distributing on behalf of many providers, as Akamai, Limelight and Level-3 do.

Where to put the servers

CDNs adopt one of two placement philosophies. Enter deep puts server clusters inside access ISPs all over the world, as close to end users as possible. Bring home builds a smaller number of large clusters instead, usually at Internet Exchange Points.

Two ways to place CDN servers
5 hops: Origin data centre → Tier-1 → IXP → Regional ISP → Access ISP → Viewer
Origin data centreTier-1Tier-1IXPBring-home clusterRegional ISPAccess ISPEnter-deep clusterViewer

Drag any device to rearrange the picture. Hover a link to see its rate, delay and length.

The same ISP hierarchy from §1.3.3. Play a journey from each kind of cluster and count the links it crosses.

Read this diagram as text
  • Origin data centre wired link Tier-1
  • Origin data centre wired link Tier-1
  • Tier-1 wired link IXP
  • Tier-1 wired link IXP
  • IXP wired link Bring-home cluster
  • IXP wired link Regional ISP
  • Regional ISP wired link Access ISP
  • Access ISP wired link Enter-deep cluster
  • Access ISP wired link Viewer
Enter deep and bring home
Enter deeppioneered by AkamaiBring homeLimelight and many others
Where the clusters go
How many sites
What it buys
What it costs

Cells marked ⓘ have a reason behind them — click to read it.

Two philosophies, and neither is simply better. Click any ⓘ.

Once the clusters exist, the CDN replicates content across them. It may not want a copy of every video everywhere, since some are rarely watched or popular only in certain countries. So many CDNs use a simple pull strategy. Suppose a client requests a video from a cluster that does not hold it. The cluster fetches it, from a central repository or another cluster, and stores a copy locally while streaming it to the client at the same time. When storage fills, infrequently requested videos are removed — exactly as a web cache behaves in §2.2.5.

How you get steered to one

Now the mechanics. When a browser is told to retrieve a video by URL, the CDN must intercept the request. It has to choose a suitable cluster and redirect the client to a server in it. Most CDNs use DNS to do this.

Figure 2.25 — DNS redirects a request to a CDN server
message 6 of 6
User’s hostTimeLDNSlocal DNS serverTimeNetCinemaauthoritative DNSTimeKingCDNauthoritative DNSTimeKingCDN servercontent distributionTimeanswers with a NAME, not an address1 — visit the NetCinema web page2 — DNS query for video.netcinema.com3 — relayed to NetCinema’s authoritative server4 — second query, for a1105.kingcdn.com5 — the address of a CDN server6 — TCP connection, then GET the video

Click any arrow to see what that message says and why it is sent.

Six steps. The interesting one is step 3, where an answer arrives that is not an address. Click any arrow.

Read this diagram as text
  1. User’s host sends 1 — visit the NetCinema web page to NetCinema. An ordinary page load. Each video on it has a URL containing the string "video" and an identifier — for example http://video.netcinema.com/6Y7B23V.
  2. User’s host sends 2 — DNS query for video.netcinema.com to LDNS. The user clicks the link. The host must resolve that hostname before it can fetch anything.
  3. LDNS sends 3 — relayed to NetCinema’s authoritative server to NetCinema. Here is the hand-over. NetCinema’s server observes the string "video" in the hostname and, instead of returning an IP address, returns a HOSTNAME in KingCDN’s domain — for example a1105.kingcdn.com. It has passed the question to the CDN without the user or the LDNS knowing anything changed.
  4. LDNS sends 4 — second query, for a1105.kingcdn.com to KingCDN. The query has now entered KingCDN’s private DNS infrastructure, and KingCDN’s DNS system eventually returns the IP addresses of one of its content servers. It is here, inside the CDN’s own DNS, that the server the client will actually use is chosen.
  5. LDNS sends 5 — the address of a CDN server to User’s host. The LDNS forwards the address of the content-serving CDN node to the user’s host.
  6. User’s host sends 6 — TCP connection, then GET the video to KingCDN server. The client establishes a direct TCP connection with that server and issues an HTTP GET. If DASH is used, the server first sends the manifest file listing a URL for each version, and the client then selects chunks from whichever version it can sustain.

Lifelines, left to right: User’s host (host), LDNS (server), NetCinema (server), KingCDN (server), KingCDN server (server).

In plain words

The trick is in step 3. NetCinema’s own DNS server is asked for an address and answers with a name instead — one belonging to KingCDN.

Nothing is broken by this. A DNS reply carrying a name rather than an address is perfectly ordinary, as §2.4.3 showed. What it achieves is a clean hand-over. NetCinema does not have to know which KingCDN server is best, and KingCDN does not have to be told which video is being watched.

Choosing the cluster

At the core of any CDN deployment is a cluster selection strategy . The CDN learns the IP (Internet Protocol) address of the client’s local DNS server from the lookup, and must choose a cluster on that basis. Strategies are generally proprietary, but two approaches are worth knowing.

Geographically closest. Using a commercial geo-location database, map the LDNS (Local DNS Server) address to a place and pick the cluster fewest kilometres away. It works reasonably well for a large fraction of clients. It has three weaknesses:

  • the geographically closest cluster may not be closest in path length or number of hops;
  • some users are configured with a remote local DNS server, so its location says little about theirs — a problem inherent in every DNS-based approach;
  • it ignores variation over time in delay and available throughput, always giving a particular client the same cluster.

Real-time measurements. Have each cluster periodically send probes — ping messages or DNS queries — to local DNS servers around the world, and choose on current conditions. One drawback: many local DNS servers are configured not to respond to such probes.

Case study — Google’s network infrastructure

Google’s CDN infrastructure has three tiers, and each tier does a different job:

TierScaleWhat it serves
Mega data centres19, in North America, Europe and Asia, on the order of 100,000 servers eachDynamic and personalised content: search results, Gmail messages
IXP clustersabout 90 worldwide, hundreds of servers eachStatic content, including YouTube videos
Enter-deep clustersmany hundreds, inside access ISPs, typically tens of servers in a single rackStatic content, including the static parts of search-result pages. These also perform TCP splitting, covered in §3.7

Watch what happens on one search. The query goes over the local ISP to a nearby enter-deep cache, which serves the static content immediately. That same cache forwards the query over Google’s own private network to a mega data centre, which produces the personalised results.

For a YouTube video, the video may come from a bring-home cache, the page around it from the nearby enter-deep cache, and the advertisements from the data centres. Three tiers, one page.

The summary is worth sitting with: except for the local ISPs, Google’s cloud services are largely provided by a network infrastructure that is independent of the public Internet.

Check yourself

Check yourself

0 of 7 answered
  1. 1.What is the most important performance measure for streaming video, and what must it satisfy?

  2. 2.predictIn the plot, set the available throughput to 800 kbps. Which version does DASH choose, and what does plain HTTP streaming deliver?

  3. 3.In DASH, which side decides which quality to play, and how does it know?

  4. 4.Why not simply build one enormous data centre and stream every video from it?

  5. 5.Akamai puts clusters in thousands of access ISPs; Limelight puts large clusters at tens of IXPs. What is each buying and paying?

  6. 6.In the six-step redirect, what does NetCinema's own authoritative DNS server return when asked for video.netcinema.com?

  7. 7.A CDN picks the cluster geographically closest to the client's local DNS server. Name a way this can go wrong.

What to remember

  • The measure that matters is average end-to-end throughput, and it must be at least the video’s bit rate. A buffer absorbs variation in timing; it cannot invent bits.
  • DASH stores several versions plus a manifest file. The client measures its own throughput and picks a version chunk by chunk, so it adapts across clients and over time. Plain HTTP streaming gives every client the same encoding.
  • DNS is the redirect mechanism. The content provider’s own DNS server answers with a name in the CDN’s domain, not an address, and the CDN’s DNS then chooses the server.