Almost every gamer loves to watch how others play, resulting in Twitch being a super popular video streaming platform as it is!
According to TwitchTracker.com in August 2019 only, Twitch have shown 999 Million Hours of video content to viewers. Average concurrent viewers reached 1,342,559.
What are the monthly infrastructure costs does the Twitch has? Let’s find out!
We know that Twitch gets video from the broadcaster, transcodes it to HLS video format and sends it further to viewers. Technically this is done via a network of servers across the world called CDN (Content Delivery Network).
Twitch can have those servers physically or rent them from bigger cloud companies. We can estimate both options.
But first, we determine the amount of data Twitch send back and forth to all viewers. According to Twitch rules, 6000 kbps is the maximum bitrate allowed. But many streamers use lower bitrate, since not every internet connection is stable enough to send 6000 kbps steadily. I would choose 3000 kbps (3 Mbps) as an average for all users.
Now we calculate how many megabytes we send in 1 hour when streaming at 3 Mbps speed. For that, we divide 3 Mbps/8 and get 384 kilobytes per second. Next, multiply 384 kilobytes per second * 60 seconds * 60 minutes = 1350 Megabytes per hour.
Good, now we multiply all our 999 million hours x 1350 Megabytes per hour and receive huge data traffic number: 1,348,650,000,000 megabytes.
Or if we convert it: 1,317,041,016 Gigabytes or 1,286,173 Terabytes, or 1,256 Petabytes.
Quite a lot, heh? 🙂
Let’s convert that to dollars $ now. What if Twitch decides to use Amazon?
There are different prices for data usage and Amazon charges different rates for different regions. But since Twitch sends Petabytes, I will use the last number of $0.02 per GB as an average. One more thing, Amazon says it has special discount rates for Customers who send more than 10 TB/month. Let’s take a guess and decrease the price to $0.010 per GB. By the way, 1 cent per GB is a usual thing for clouds like DigitaOcean, so we are quite close in our assumptions.
UPD Jan 30, 2020: Recently I’ve read an article from our partners, and they claim that the lowest CDN price could be actually one tenth of a cent, $0.001.
Good, now we multiply Twitch August data traffic of 1,317,041,016 Gigabytes by one tenth of a cent and receive a $1,317,041 price. Yes, this is $1,3 million USD per month, only for the data traffic.
Ok, so that was Data Traffic. And Twitch also needs servers to run the show. How much is that?
Some companies claim they can run HLS on one server supporting 50.000 viewers. That’s ok, but in our Twitch case the video bandwidth is as high as 3 Mbps and we will hit the ceiling with the network capacity per one server. Amazon provides 20 Gbps network per one server (not for all servers, just for special plans). So if we divide 20 Gbps per 3Mbps, we will get somewhere 7000 viewers per server.
Let’s calculate the numbers for Amazon. I think a1.large* server ($0.051 per Hour) should do the work. So we take our number of average viewers 1,342,559 and divide by 7000 viewers per server: and we get 192 average servers. Not that many. But this is the ideal situation, I would say we need to multiply that amount by 3x to have stable video delivery. So 3×192 = 576 servers. And monthly costs would be $771,120 per month for all those 576 servers running 24/7.
*a1.large has lower network capacity than 20 Gbps, but let’s assume a big company can ask Amazon to increase that server network bandwidth
Now get back closer to reality. I think Twitch uses its own servers, but I’m not sure they can save much here. They need to buy those machines, colocate them, pay for electricity, pay colocation rent, etc. Let’s leave that number as it is $771K per month for servers running.
Summary: by simple calculations we can assume that Twitch may spend around $4,000,000 – $6,000,000 every month for the Data traffic and $771,000 on top of that for servers.
P.S. I haven’t included here a team of DevOps (Development Operations) engineers who monitor the servers all the time. I would assume Twitch needs at least 6 engineers to support the platform 24/7.
We are Trembit.com ! Specializing in building complex video streaming systems. Let’s verify your ideas together at : firstname.lastname@example.org views