🏏Scalable Emoji Broadcasting System - Hotstar
Hotstar first introduced Sports Bar in 2019. In the world cup 2019, 5 Billion Emojis from 55.83 Million users during the ICC Cricket World Cup 2019.
Hotstar main aim was to convert the sounds and responses in the live cricket ground. These are nothing but audience reactions in a digital way of expressing emotions. Showing the mood of the audience and displaying the changing moods in real-time is challenging when you plan to receive billions of such emoji submissions during a tournament.
Functional Requirements
Users can browse and select stickers during live cricket matches found in the sports bar.
Stickers can be sent over a live
Stickers appear instantly in the live chat interface.
Non-Functional Requirements
High availability to support concurrent users during peak traffic.
Low latency for real-time sticker delivery.
Secure transmission and storage of sticker data.
Scalable infrastructure to accommodate increasing user base and traffic.
Key Design Principles
Scalability: Increase the resources with increase in traffic. Hotstar achieved this by using the horizontal scaling with load balancers and auto scaling of the resources configured
Decomposition: Breaking into small components and each being allowed to do the particular task independent of each other.
Asynchronous: Process execution should not block the resources and provides high concurrency.
Envelope Calculations
Assume the scenario of World cup 2019, Target was to scale upto 5 Billion Emojis from 55.83 Million users over 48 Matches.
Total users would be around 55.83 Million users, lets do some assumption by considering 20% of the total users are active. So the number of concurrent users are 0.2 * 55.83 which is around 11.166 Million users.
Now let's do some calculations on the emojis.
Total Emojis received: 5 Billions
Average Emoji's Per Match: 5,000,000,000 / 48 ~ 104166667 emojis per match.
Each match duration is 3 hours
Number of Emojis per hour: 104166667 / 3 = 34722222.3
Number of Emojis per second: 34722222.3 / 3600 = 9645.06175 ~ 9646 emojis per second
Storage Calculations
Now lets calculate the size of the emoji data we need to store:
Size of the emoji data is 230 B
Total Emojis per second: 9646
Total increase in memory size per second: 9646 * 230 = 2218580 Bytes = 2.21 MB
Every match we need almost 2.21 * 3600 * 3 = 23.89 GB of data
Entire World it needs 23.89 * 48 = 1146.72 GB ~ 1.2 TB
For the world cup total data for the emojis would be around 1.2 TB
System Components
Hotstar defined the technologies in the blog mentioned in the references:
References
https://blog.hotstar.com/capturing-a-billion-emojis-62114cc0b440 https://blog.hotstar.com/building-pubsub-for-50m-concurrent-socket-connections-5506e3c3dabf https://blog.scottlogic.com/2018/04/17/comparing-big-data-messaging.html https://blog.hotstar.com/data-democratisation-hotstar-93ebfb1e688d https://medium.com/@chandanbaranwal/spark-streaming-vs-flink-vs-storm-vs-kafka-streams-vs-samza-choose-your-stream-processing-91ea3f04675b https://www.debugbear.com/json-size-analyzer https://blog.hotstar.com/hotstars-journey-from-ec2-to-containers-86ea4e4880fd https://newsletter.systemdesign.one/p/hotstar-architecture
Last updated