Real architecture · Staff
Hotstar: 25 million concurrent viewers
Real production architecture. Key points: overload control.
Short answer
Real production architecture. Key points: overload control. Hotstar is a Disney streaming (OTT) service. According to an account of an AWS re:Invent talk, on July 10, 2019 it reached 25.3 million concurrent viewers, surpassing the service's own previous record of 18.6 million. The peak came during the India vs. New Zealand match of the 2019 Cricket World Cup.
01 · CONTEXT
A live audience record
Hotstar is a Disney streaming (OTT) service. According to an account of an AWS re:Invent talk, on July 10, 2019 it reached 25.3 million concurrent viewers, surpassing the service's own previous record of 18.6 million. The peak came during the India vs. New Zealand match of the 2019 Cricket World Cup.
As early as April 2018, the company's engineering blog described the preparation for the IPL, Hotstar's big event of the year. Both accounts, the 2018 post and the 2019 talk summary, argue for scaling ahead of the event instead of reacting to it.
02 · THE PROBLEM
Notification, spike and overload
The post describes a pattern the old platform faced repeatedly: when something interesting happened in the match, a notification was sent, and the resulting traffic spike overloaded the back-end systems and sometimes disrupted video rendering. The team says it learned to deal with these tsunamis the hard way.
Something interesting happens in the match and the notification service alerts the apps.
The resulting traffic spike hits the back end.
The spike overloads the back-end systems.
Sometimes the overload even disrupts video rendering.
Automatic retries make things worse. That is why the post calls for clients that infer when something is wrong and add jitter to the requests they make to the servers.
03 · PRE-SCALING
Why not rely on autoscaling
The post's first lesson is to leave capacity headroom instead of counting on autoscaling. Given how long autoscaling takes to act, it is useless for handling spikes; the strategy is to estimate peak concurrency and raise capacity before the event.
Autoscaling does not disappear from the design: the post uses it to keep the right number of servers in the pool, but the fleet is already scaled for the peak. When the team crosses the headroom thresholds, defined after the scale tests, it brings up more capacity in advance.
The talk summary repeats the thesis: traditional autoscaling does not work for Hotstar. The slides list as reasons insufficient-capacity errors, a single instance type per autoscaling group and the group's step size. The post adds that the cloud provider also has physical limits on how much can be scaled automatically, and that you need to work with them and plan capacity ahead of time.
Escalar ahead of time includes, according to the practices listed in the slides: pre-warming the infrastructure before the match, scaling by request count or by platform concurrency, doing proactive, automated scaling based on concurrency and using a spot EC2 fleet with diversified instance types. Asked what the alternative to traditional autoscaling would be, the recorded answer was a plain Python script.
Before the match, the team estimates peak concurrency and brings the fleet up to that capacity.
During the match, request count and platform concurrency become metrics.
If the headroom defined in the tests is exceeded, the scaling script brings up more capacity in advance.
Caching in the service layer and TTLs on the client take traffic off the origin and give the fleet headroom.
| Criterion | Traditional autoscaling | Hotstar pre-scaling |
|---|---|---|
| When it acts | Useless for spikes given how long it takes to act | Before the event, from the estimated peak |
| Capacidade | Insufficient-capacity errors and physical provider limits | Infrastructure pre-warmed before match time |
| Gatilho | Autoscaling group with a single instance type | Request count or platform concurrency |
The slides under the title Race against time list a growth rate of more than 1M per minute, an application boot time of around one minute, 90 seconds of reaction time, push notifications and fully pre-baked AMIs.
04 · PROTECT AND DEGRADE
Protected origin, smart client
The post divides the platform into three pillars: the subscription engine, the metadata engine and the streaming infrastructure. Each has its own scaling needs and was tuned separately, with pessimistic traffic models and ladders that controlled the fleets according to estimated concurrency.
| Mecanismo | What it does |
|---|---|
| Only once | Keeps as much traffic as possible away from the origin servers |
| Reject early | Keeps spurious traffic away right at the top of the funnel |
| Funnel with jitter | Lets clients advance at an acceptable rate |
| Panic switches | Tell the apps to ease off requests, with exponential or custom backoff |
| Cache with an appropriate TTL | Buys the servers a lot of headroom |
The funnel has an external limit: Hotstar depends on the processing rates of its payment partners, and so, sometimes during a spike, it may add jitter to the funnel so clients advance at an acceptable rate.
On the client, the apps were built to be resilient and degrade gracefully. Panic switches in the infrastructure tell the apps to ease off requests for a moment, with exponential or, at times, custom backoff, which gives the back end time to recover. The primary function is preserved: specific functions can degrade without affecting it.
The diagram shows the app and the video, subscription and payment, and recommendation services.
When load gets out of control, the panic switches signal the app to ease off requests.
The app slows down with backoff, exponential or custom, and the back end gains time to recover.
Recommendations and personalization are turned off on purpose to protect what is critical.
Video streaming and payment, the critical components, stay up.
05 · REHEARSE FAILURE
Load testing, game days and chaos
To test scale, the post cites the use of Flood.io on top of Gatling. The team also ran game days, simulations of a real IPL event before it happened. They served to tune configurations and train operations, and revealed behaviors at scale tied to SSL handshakes, keep-alives and mismatches between AZs or regions.
Beyond simulated load, the team ran chaos tests (chaos engineering), which simulated various unavailability scenarios to see how the system reacted and recovered. Among the chaos ingredients listed in the talk are tsunami traffic, delayed scaling, bandwidth constraints, increased latency and network failure (CDN).
The talk also presents Hulk, a load generation tool used to prepare the platform for a 50M peak. In chaos tests, what you look for is each system's breaking point, as well as bottlenecks and choke points.
About telemetria, the post says it took work to get a unified view of the metrics that matter for making decisions.
06 · LESSONS AND LIMITS
What to take into the interview
The talk closes with three lessons: prepare for failures, understand the user journey and accept degrading gracefully.
The post adds the principle of ensuring the primary function always works and protecting the touchpoints with the server. Not every failure is fatal, and a cache with an appropriate TTL buys a lot of headroom.
Frequently asked questions
What is Hotstar: 25 million concurrent viewers?
Real production architecture. Key points: overload control.
What does the Hotstar: 25 million concurrent viewers design cover?
It is organized in these sections: A live audience record, Notification, spike and overload, Why not rely on autoscaling, Protected origin, smart client, Load testing, game days and chaos, and What to take into the interview.
How long is Hotstar: 25 million concurrent viewers and what level is it?
It takes about 18 minutes to read and is rated Staff level.
Now design it yourself
Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.