AWS for M&E Blog

How Twitch built the global live streaming network that powers Amazon IVS

Established brands and startups around the world are discovering the power of live interactive video – from RushTix and Codices, to DeNABeLiveGoPro, and beyond. Using Amazon Interactive Video Service (Amazon IVS), these innovative companies are transforming the future of ecommerce, fitness, user-generated content, and more by optimizing the live streaming experience for creators and audiences. A managed live streaming solution designed for developers to add live video and enable interactivity with video in their app or site without investing in streaming infrastructure, Amazon IVS was formally introduced in July 2020, but its development history traces much further back, with an origin shared with one of the world’s most widely used streaming platforms.

At any given moment, more than 2.5 million viewers are tuned into Twitch, with the site averaging 31 million daily viewers. In 2021, more than 1.3 trillion minutes of live streamed video were watched on Twitch, a sizable bump from the more than 1 trillion minutes watched on the site in 2020 and 600 billion minutes watched in 2019.

Streaming live video on a massive global scale is a notoriously difficult process due to the unpredictable nature of both the Internet and live events. Live streams must be delivered in as close to real-time as possible, especially for the kind of interactive content that runs on Twitch. Today, more than 98-percent of all Twitch traffic remains on its network, one of the largest in the world dedicated exclusively to live streaming. However, its beginnings are far more humble.

Launching ‘lifecasting’  

Born as Justin.tv in 2007, Twitch was founded by Emmett Shear, Justin Kan, Kyle Vogt, and Michael Seibel. Initially only available in the US, the site’s first iteration featured a 24/7 live stream of Kan doing everyday tasks. Justin.tv was later opened up for other creators to live stream, while a section dedicated to video game streaming was launched as Twitch Interactive in 2011. Early infrastructure encompassed a few computers in a co-located facility delivering video via a third-party content delivery network (CDN), which quickly racked up massive bills. Looking for a more economical approach to their venture and to expand audience reach, the founders searched out a way to deliver video directly to save money; their solution was to hire Jon Shipman, a networking expert who launched Twitch down the road of building its own infrastructure.

As an event-driven platform, Twitch traffic has always fluctuated, often spiking significantly, which could be stressful in the early startup days. Co-founder Shear explained, “Kyle and I used to wake up super early on Saturday mornings so that we could oversee the servers during peak viewing events. After a solid nine months of this, Kyle took a much-deserved vacation, but he was totally off the grid and our servers started to experience failure. Someone on our team called a pizza place near where he was staying and got them to deliver a pizza with a message on the box written in Sharpie, something to the effect of: ‘The servers are down. We need you to fix it.’ Needless to say, he did.”

Laying the foundation for growth  

Twitch eventually began hosting almost all of its own traffic, to ensure video quality, and minimize reliance on CDNs. “It would be challenging to serve a global audience well using only the public Internet because Twitch would be susceptible to bottlenecks,” noted Martin “Marty” Hess, the General Manager of Amazon IVS who is responsible for the video infrastructure that Twitch uses. “For example, if a video originates in San Jose, California and the viewer is in Berlin, Germany, there are many places the video can get delayed. Maintaining a private network of backbone links and PoPs [Point of Presence] provides far better control over the quality and global delivery of the stream.”

Along with adding capacity throughout the years, Twitch expanded its dedicated network and data center team with its acquisition by Amazon in 2014. The specialized team ensures its software works across thousands of servers globally and at the lowest latency possible, automatically working around component failures, so that problems in one location don’t affect the system around the world. The team became hyper-focused on developing unified media streaming software that would never fail and optimize streams.

“We have local PoPs in every major market. On top of this, we have our software layer that’s constantly making micro adjustments to deliver the highest quality video for the available bandwidth. Our network is only used for live video, which is pretty unique,” said Hess.

Developing with an eye on user experience

With live streaming its core offering, stability was (and remains) paramount to Twitch. “In the early days, we relied on third-party software for taking video from broadcasters and preparing it for distribution, but a single failed instance would take down multiple streams, so we became focused on never letting our system crash, ever. Then, one of our developers wrote distribution software, basically over a weekend. It was quite a technical flex, but it got a lot of attention and showed us that it was possible,” recalled Shear.

“It took us about a year to fine-tune the software and get it ready for production, and after rigorous testing, we rolled it out across the network,” added Hess. “A version of this software is also now publicly available through Amazon Interactive Video Service (Amazon IVS), which was launched in July 2020. Amazon IVS allows users to harness the power of Twitch’s live video streaming technology and spin up channels in minutes.”

Prioritizing a dedicated global video network

One reason Twitch has been able to keep up with a historic peak in demand throughout the pandemic is because of a dedicated global video network. Shear shared, “Thankfully we had the additional capacity in place to continue delivering a high-quality, interactive live streaming experience as our audience grew beyond even what we expected. We also further optimized video quality for reliability on available bandwidth, including offering only SD streaming options when public Internet infrastructure was particularly constrained in the early days of lockdowns.”

Noted Hess, “Twitch has dealt with unique challenges, like managing live streams that jump from ten viewers to more than a million viewers in seconds. Solving these problems has resulted in rock solid video technology that now other customers can use too.”

Building for the future

There is no magic formula to account for Twitch’s enduring success, but the company’s unrivaled focus on live video experiences and technologies has been key to facilitating growth. “I think we’re still at the beginning of what you can do with live video. Amazon IVS is meant to let everyone else do what we got to do with Twitch, and make it easy to wire up live video,” said Shear.

To learn more about building interactive live video experiences with Amazon IVS, visit: https://aws.amazon.com/ivs/

Lara Stiris

Lara Stiris

Lara Stiris leads growth for Amazon Interactive Video Service, focusing on building and nurturing a community of developers creating interactive live streaming experiences.