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) Domain Name System Translates a human-friendly name such as www.ietf.org into a network address. introduced in ch. 1 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) HyperText Transfer Protocol The application-layer protocol that requests and transfers Web documents. introduced in ch. 1 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 streaming stored video Simple Watching a recorded video while it is still arriving, instead of waiting for the whole file. Precise An application whose underlying medium is prerecorded video placed on servers, which users request to view on demand. From a networking point of view the salient characteristic of video is its high bit rate: from 100 kbps for low quality to over 10 Mbps for 4K. The most important performance measure is average end-to-end throughput, which must be at least the bit rate of the compressed video for continuous playout. introduced in ch. 2 — open in glossary 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 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 http streaming Simple Storing a video as an ordinary file and fetching it with a normal web request. Precise A scheme in which the video is stored at an HTTP server as an ordinary file with a specific URL. The client issues an HTTP GET, collects the bytes in a client application buffer, and begins playback once the buffer passes a threshold. Its major shortcoming is that every client receives the same encoding, whatever rate it can actually sustain. introduced in ch. 2 — open in glossary the video is simply stored at an HTTP server as an ordinary file with a specific URL (Uniform Resource Locator) Uniform Resource Locator The address of a single Web object: hostname plus path name. introduced in ch. 2 . The client opens a TCP (Transmission Control Protocol) Transmission Control Protocol The Internet transport protocol that delivers data reliably and in order, with flow control and congestion control. introduced in ch. 1 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 dynamic adaptive streaming over http Simple Storing several qualities of a video, and letting the player pick, chunk by chunk, what it can afford. Precise DASH. The video is encoded into several versions, each with a different bit rate and quality level, each stored under its own URL. The client requests chunks of a few seconds’ length one at a time. 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. It therefore adapts both across clients and over time for one client. introduced in ch. 2 — open in glossary ( DASH (Dynamic Adaptive Streaming over HTTP) Dynamic Adaptive Streaming over HTTP Chunk-by-chunk quality selection driven by the throughput the client measures. introduced in ch. 2 ) 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 manifest file Simple The list telling the player which versions of a video exist, and where each one is. Precise A file held by the DASH HTTP server that provides a URL for each version of the video along with its bit rate. The client requests it first to learn what versions exist, then selects one chunk at a time by giving a URL and a byte range in an HTTP GET request. introduced in ch. 2 — open in glossary , 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.
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
- 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.
- 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.
- 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 content distribution network Simple A fleet of servers spread around the world, each holding copies of the content. Precise A CDN manages servers in multiple geographically distributed locations and stores copies of videos and other Web content in those servers. It then tries to direct each user request to the CDN location that will give the best user experience. It may be a private CDN owned by the content provider itself, such as Google’s or Netflix’s, or a third-party CDN serving many providers, such as Akamai or Limelight. introduced in ch. 2 — open in glossary ( CDN (Content Distribution Network) Content Distribution Network Geographically distributed servers holding copies of content close to users. introduced in ch. 2 ). 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 enter deep Simple Putting many small server clusters inside access ISPs, right next to the users. Precise A CDN server placement philosophy, pioneered by Akamai, of entering deep into the access networks of ISPs by deploying server clusters in thousands of locations. The goal is to get close to end users, improving delay and throughput by reducing the number of links and routers between the user and the serving cluster. The cost is that maintaining and managing the clusters becomes challenging. introduced in ch. 2 — open in glossary puts server clusters inside access ISPs all over the world, as close to end users as possible. Bring home bring home Simple Putting a few large server clusters at exchange points instead of many small ones. Precise A CDN server placement philosophy, taken by Limelight and many others. It builds large clusters at a smaller number of sites — for example tens — typically placed in IXPs rather than inside access ISPs. It gives lower maintenance and management overhead, possibly at the expense of higher delay and lower throughput to end users. introduced in ch. 2 — open in glossary builds a smaller number of large clusters instead, usually at Internet Exchange Points.
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 deeppioneered by Akamai | Bring 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 pull caching Simple A cache fetches and stores content the first time somebody asks for it. Precise A strategy in which a cluster that does not hold requested content fetches it on demand. It retrieves the content from a central repository or another cluster, stores a copy locally, and streams it to the client at the same time. When storage fills, infrequently requested content is removed. YouTube uses pull caching. introduced in ch. 2 — open in glossary 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.
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
- 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.
- 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.
- 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.
- 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.
- 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.
- 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 cluster selection strategy Simple The rule a CDN uses to decide which of its clusters should serve you. Precise The mechanism for dynamically directing clients to a server cluster or data centre within a CDN. The CDN learns the IP address of the client’s local DNS server from the DNS lookup and chooses on that basis. One approach picks the geographically closest cluster, using a geo-location database; another picks the cluster with the best periodically measured delay. Both have weaknesses: some users are configured with a remote local DNS server, and many such servers do not answer probes. introduced in ch. 2 — open in glossary . The CDN learns the IP (Internet Protocol) Internet Protocol The network-layer protocol that defines the datagram format and addressing every Internet device must use. introduced in ch. 1 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) Local DNS Server The nearby server a host queries first; a CDN identifies a client by its address. introduced in ch. 2 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:
| Tier | Scale | What it serves |
|---|---|---|
| Mega data centres | 19, in North America, Europe and Asia, on the order of 100,000 servers each | Dynamic and personalised content: search results, Gmail messages |
| IXP clusters | about 90 worldwide, hundreds of servers each | Static content, including YouTube videos |
| Enter-deep clusters | many hundreds, inside access ISPs, typically tens of servers in a single rack | Static 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 answered1.What is the most important performance measure for streaming video, and what must it satisfy?
2.predictIn the plot, set the available throughput to 800 kbps. Which version does DASH choose, and what does plain HTTP streaming deliver?
3.In DASH, which side decides which quality to play, and how does it know?
4.Why not simply build one enormous data centre and stream every video from it?
5.Akamai puts clusters in thousands of access ISPs; Limelight puts large clusters at tens of IXPs. What is each buying and paying?
6.In the six-step redirect, what does NetCinema's own authoritative DNS server return when asked for video.netcinema.com?
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.