At peak times, Netflix accounts for around a third of the consumer Internet traffic in North America. This week, one of its senior engineers described how it gets all those movies to your screen.
The company operates its own content delivery network (CDN), a global network of storage servers that cache content close to where it will be viewed. That local caching reduces bandwidth costs and makes it easier to scale the service over a wide area.
Netflix used to rely on third-party providers like Akamai and Level 3 for the caching work, but two years ago it said it had started building its own CDN, called Open Connect. It now delivers all its content via that network, said David Fullagar, director of content delivery architecture at Netflix, in a talk at the Uptime Institute's data center conference in Silicon Valley.
Netflix also designs its own storage hardware, custom built for streaming video. It uses two types of server, one based on hard disk drives and the other on flash drives, and both are optimized for high-density and low-power use.
Most widely used are the hard drive systems. They cram 36 3.5-inch drives into a server about 6 inches high (four rack units) and 2 feet deep. The servers each store 100TB of data and stream between 10,000 and 20,000 movies simultaneously, Fullagar said. There are about 1,000 of the storage systems total in its network, he said.
Netflix refreshes its hardware design about once a year with the latest drives and low-power Intel processors. It loads the servers with movies and TV shows before it ships them out, because even over high-speed networks it takes time to load 100TB of content remotely.
The servers run mostly open-source software -- the Free BSD operating system, nginx Web server and BIRD routing software -- with a layer of Netflix software on top.
Netflix has a huge library of content -- more than a petabyte -- so during quiet periods between midnight and lunchtime it prepopulates the servers with the content it thinks people will want to watch, reducing bandwidth use in peak hours.
The content still has to get from the CDN to end users, and it's carried by local ISPs (Internet service providers) who connect to the CDN in one of two ways: they peer with it at common Internet exchanges -- basically big data centers where different network providers connect to each other -- or they can install Netflix's storage systems, which it provides them for free, on their own premises.
It currently has servers at 20 different peering locations, and "many tens" of ISPs also have them on site, Fullagar said. For the ISP, having the content on site reduces its inbound bandwidth costs.
There are lots of reasons for Netflix to operate its own CDN. With its service accounting for such a high proportion of ISP traffic, it's better for it to have a direct relationship with them than work through companies like Akamai.
It also gives Netflix "end-to-end control" of its network, providing more opportunities to optimize the system. Its servers are purpose built for streaming movies, for instance, with the spinning disks carefully laid out to minimize "heat spots," or areas of overheating.
It also does lots of intelligent mapping in the network, to figure out the best location to stream each movie from. Netflix has close to 50 million streaming customers, in North America, South America and parts of Western Europe, and it's likely to expand further in future.
Netflix also uses Amazon Web Services, for tasks like running its website and its recommendations engine. Also, the movie studios upload their content to the Amazon cloud, where Netflix encodes it to its format before distributing it to its network.
"Whereas with Amazon we're a relatively small compute customer, on the CDN side we're a very large player," Fullagar said.
Only about 40 people work on the CDN, he said, with half working on software, 10 network engineers and 10 in operations.
Building the CDN wasn't without hiccups. Around the time Netflix started to roll it out two years ago, Thailand was hit by devastating floods that disrupted much of the world's hard disk supply. "I wouldn't say it derailed us, but it was problematic," Fullagar said.