Hotstar: 25 million watching
On July 10, 2019, India played New Zealand in the World Cup semi-final and 25.3 million people watched on Hotstar at the same moment. You're running one fiftieth of that: 20,000 req/s. 80% are pieces of live video, and every request reaches your own servers. Recommendations sit in the path of every page, with nothing to stop them taking the app down.
Play this levelPart of Bugpit Pro. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
Live video is the easy part to move. Every viewer asks for the same few seconds of the same match, so a CDN answers almost all of it, and object storage holds the original. Hotstar's peak used more than 10 Tbps, by its own account most of India's internet capacity at that moment.
The hard part is the crowd's shape. When a famous batsman walks out, a million people can arrive in a minute. Hotstar said a new server took about 90 seconds to get ready, and normal autoscaling reacts after the load arrives. So they scaled before the match, based on how many people were watching, not on how busy the servers looked.
That's why the app servers here are sized for the peak before you press Run. There's no time to add them once the crowd is in.
And when it still goes wrong, decide in advance what can be switched off. Hotstar called it panic mode: turn off recommendations and personalisation, and keep video and subscriptions working. A circuit breaker does that automatically: if recommendations fail, the page loads without them.
What you have to achieve
20,000 requests a second at the busiest hour, 1% of them writes and 80% static files.
- No broken or illegal connections
- Use a CDN
- Use an Object Storage
- If every Internal Service machine dies, under 0.1% of requests fail
- No component is overloaded
- Fewer than 0.1% of requests fail
- p99 response time under 250 ms
What you learn
Crash Recommendations: the match keeps playing. Two ideas carried this night. Plan capacity for the crowd you know is coming, because reacting is too slow. And know which features you can live without, before you need to.
The real numbers behind it
- 25.3 million concurrent viewers at the 2019 World Cup semi-final, India vs New Zealand (Reported: AWS re:Invent 2019 (CMY302): how Hotstar handled 25 million concurrent viewers)
- Peaks of more than 1 million requests a second and more than 10 Tbps of video (Reported: AWS re:Invent 2019 (CMY302): how Hotstar handled 25 million concurrent viewers)
- About 90 seconds to react while viewers grew by more than a million a minute, so infrastructure was warmed up before the match (Reported: AWS re:Invent 2019 (CMY302): how Hotstar handled 25 million concurrent viewers)
- Panic mode turned off recommendations and personalisation to keep video and subscriptions running (Reported: AWS re:Invent 2019 (CMY302): how Hotstar handled 25 million concurrent viewers)
- 20,000 req/s with 80% video at one fiftieth of the peak. Hotstar doesn't publish this mix (Estimate)
Check yourself
A new server takes 90 seconds to get ready, and a million viewers can arrive in a minute. What did Hotstar do?
- Waited for autoscaling
- Scaled up before the match, based on how many people were watching
- Limited viewers to 10 million
Show the answer
Scaled up before the match, based on how many people were watching. Reacting is too slow for a crowd you know is coming. Plan for it in advance.
What did Hotstar's panic mode switch off to keep the match playing?
- Video
- Subscriptions
- Recommendations and personalisation
Show the answer
Recommendations and personalisation. Decide in advance what you can live without. A circuit breaker does it automatically.