A brief system design case study
How we scaled our campus online radio application system (SUSTCast)?
Creating a horizontally scalable system is probably the most satisfying thing for a system architect.
Preface
SUSTCast is the online radio station of Shahjalal University of Science and Technology. It has a mobile application where users can log in and listen to the broadcasted programs. Pretty simple, right?
Requirements
- A Mobile Application
- Sign Up, Login
- Playing radio stream
- Showing notification (About upcoming featured program)
2. 10,000 listeners in peak
Constraints
- No Funding, the system must be cost efficient
System Design
Mobile Application
The application was developed using a native android java framework. We incorporated the MVVM (Model-View-ViewModel) Design Pattern.
Cloud Service
Firebase was used for authenticating users, sending push notifications, and storing global configuration data for mobile applications.
Streaming Service
IceCast is an excellent streaming service for audio streaming. We had an array of Icecast servers running on low-resource computers (both desktop PC and cloud) which were accessible on the public network. We deployed these servers forecasting bandwidth loads.
Core Service
The core service was a set of lightweight modules. It had a database, a script, and an ices2 (IceCast client) running in a docker container. The script’s responsibility was to stream the program to the IceCast servers using ices2. Furthermore, the core script updated the firebase real-time database with the metadata of the program being streamed.
Why this design is horizontally scalable?
Because, when the number of listeners increases it puts the load on two resources, cloud service (notification/database/auth) and streaming service. We have decoupled these services from the core service. Furthermore, the core service could be run from anywhere with an internet connection. Whenever we faced a spike in users, we just had to spawn some Icecast servers (AWS/Hetzner). Our mobile application would get the address of these servers from the firebase database and play the programs accordingly.
Special thanks to my teammate Istiak Shihab and Abrar Fahim for helping me with this article. Also, kudos to all current members working for SUSTCast.
Want to Connect?
If you have any feedback, please ping me on my LinkedIn: https://linkedin.com/in/shuhan-mirza/