top of page
Writer's pictureRohit Modi

System Design : Live Streaming distribution through Content Distributed/Delivery Network

Updated: May 23, 2023

Hi, a warm welcome to tech-maze, this article is continuation of How Content Distributed/Delivery Network aka CDN works and its uses, As we know from previous article CDN is being used by application which has presence in multiple countries to deliver the content fast and efficiently.


In this article we will talk about uses of CDN in live streaming, CDN is one of the most important factor when any application does live streaming in multiple countries.


CDN helps an application which sends video through network, guaranteed delivery and maintain the quality of video, lets explore this with following diagram and explanation of each stages.



Client opens the app and start a video, in the background a request goes to CDN server and CDN server sends response containing location of video which has saved in distributed file system, client redirected to the location of video and video starts playing


It looks quite straight forward but many modules have involved here, lets see how a live streaming video makes it available to client or user.


Step 1:


Live streaming video saves in the main server in the form of chunks and transformed to multiple pixel sizes such as High Definition, 1024 px, 720 px, 480 px etc.

These live stream videos transfers through Real Time Messaging Protocol which is implemented over Transmission Control Protocol, now the question is why do we use RTMP , why not HTTP or HTTPS or TCP, the reason being is RTMP is a special type of protocol developed for transferring live videos without distorting its content and quality, this protocol intact the quality of video.


RTMP maintains a constant connection between the client and server, which allow Real Time Messaging Protocol to act as a pipe between client and server and it rapidly moves video data to the viewers.


Since RTMP implemented over Transmission Control Protocol (TCP), it uses a three-way handshake when transporting data. The initiator which is client (mobile, laptop, desktop etc) asks the accepter which is server to establish a connection, server responds to client with data and client acknowledges the response and maintains a session between both end.


Step 2:


live streaming video transfers via network to distributed servers (an application which has used in multiple countries have their server in those countries for faster access of data, data access is faster because client request don't have to go through multiple hops and don't have to make multiple network calls to reach main server).

Here RTMP has used over TCP to keep the video quality close to original quality

and video has saved in distributed file system for fast access


Step 3:


Now response reaches to CDN, CDN take this response and forward to applicable client machine (mobile, tablet, laptop, desktop), while doing this CDN provide the location url of corresponding video on which app redirect the user and start playing the video.


so response flowing from geographical located server to CDN followed either Push CDN or Pull CDN, but in this case where time and performance are crucial, Pull CDN is the preferred choice.


So now we understood that how CDN improves the customer experience when they watch live streaming concert, sports, events etc.


Current industries are looking for alternative of RTMP and moving towards HTTP-based (Hypertext Transfer Protocol) protocols, because of its simplicity, it also improves scalability and viewing experience by allowing local servers to cache streaming content.

Technique which works with HTTP is known as adaptive bitrate streaming which has become more common, and allowing broadcasters to optimize content for viewers’ devices such as mobile, laptop, HD screen etc and connectivity.

Its still not reached to many industry but in future this technique will improve and reduce the uses of RTMP, but till today RTMP dominates all other technique when it comes to video, audio streaming and its market share is 76 percent.


That's all folks in this article, keep visiting, feel free to share this article and share your suggestion/thoughts in comment section.


A Big thank you for checking out my article, this really encourage me to come up with more topics.

Here are some resources you might be interested ------------------------





66 views0 comments

Comments


Spring Boot
bottom of page