The building blocks of a Streaming Media CDN

Don’t just build any CDN with MistServer, build your perfect one. Learn here exactly what type of benefits MistServer brings when it comes to delivering your content, no matter the size of your current or future platform.

Takes about 9 mins to read
Published at 7 Dec 2023

The internet has truly become a great place to share media. You can connect to anyone in just a few seconds, and a single server could even have worldwide reach. However, as you might have experienced, using just a single server does not provide a similar experience to everyone connected. Connection speed and quality greatly differ per region, and it is a hurdle anyone serious about their media will need to challenge. Luckily, there is an easy proven solution: Content Delivery Networks.

Content Delivery Networks

A Content Delivery Network (CDN) is the solution to providing worldwide similar quality. The longer the connection between the server and viewer, the higher the chance something can go wrong or get delayed. There's no real way around it; if you want to provide the best user experience, you will need a server relatively nearby. CDNs are just that — a network of servers working together to provide content to the users of the CDN. One thing to keep in mind is that a huge media platform isn't necessarily composed of one CDN but does provide users a single point of entry. Users of a platform might be using multiple CDNs in the background.

Traditional CDNs

Traditional CDNs have a very strict split between Origin/Ingest servers and Edge/Egress servers, each with its own focus.

An origin/ingest server is responsible for making media available in the network. This could involve having access to a library or being the ingest point for other companies or even users to send content toward. The origin server is responsible for ensuring that the content can be received and used by the edge/egress servers. An edge server is responsible for the distribution/delivery of the content and shares this directly with the viewers. The primary reason why a traditional CDN operates in this way is to ensure the safety of the origin servers. The origin servers hold all the content and cannot ever go offline, or all edge servers will be without content to serve viewers. Scaling up usually means adding additional edge servers to locations where you expect more viewers, while origin servers typically do not need to scale up as often. However, a good practice is ensuring there are enough origin servers to have failovers should one go down or need maintenance.

While the core of a CDN is ensuring content gets to your viewers, there could be several other processes that are important to have in a CDN. You will need to determine who can watch what and when. Some content received might not be immediately ready for distribution and needs preparing. This could involve adding additional qualities or even changing the entire format of the media. It's never as simple as "just get the media out there."

MistServer as a CDN

Linking several MistServers together will already create a CDN, but can you build a traditional CDN using MistServer? The answer is yes, but you might want to consider the alternative — a Hybrid CDN. As explained in MistServer employs a unique design, which allows MistServer to fully separate input and output processes. MistServer runs into no danger of overloading the input side of things if the output side is getting more activity. You can reserve capacity for the input side of things and allow the output to use whatever is left. Setting up servers like this will still have you end up with servers typically used as origin or edge, but at the same time, every other server can be a failover for another, no matter the focus. Even when scaling up, this comes into play; every server added would add to your platform stability. Even our most suspicious users ended up being able to scale down once they had tested the waters while enjoying higher stability before they switched.

Another use benefit of using MistServer as a CDN is maintenance. Since every connection is its own unique process, it gives you the option to update the server as a whole while keeping connections active. What happens is MistServer itself gets updated, but every process running is kept on the old version without being dropped. New connections coming in will be using the newer version of MistServer while old, outdated connections will go on until closed and slowly die off. Of course, the same principle applies to servers you want to spin down. Simply tell the load balancer to stop sending new connections to the server, wait for it to no longer serve anything, and remove it from the network.

Load balancing

The key to a successful CDN is knowing when you need to send what content where. This could also mean sending connections to less likely servers as they would provide a better experience during peak hours. In order to do so, you need a load balancer, a process that determines what the best place is to send a viewer. Now, this is where an advanced media server like MistServer truly shines. Most load balancers will just guess based on where they've sent previous viewers and assume a server will be available, not MistServer.

Our load balancer is capable of checking in with every MistServer it is connected to and knows exactly how many viewers, how much resource usage, and how much predicted usage a new viewer will take up. The combination of MistServer with a load balancer doesn't just guess the impact of viewers; it knows the impact of viewers and can make intelligent adjustments based on this knowledge. If a certain stream starts growing beyond the current capabilities, it will make sure additional servers are ready to start serving it well before a hiccup occurs.

Customizing your CDN

Now, this is the important final step of the process. Here you determine just what makes your CDN special. Is it the way you handle or combine media? Seeking the lowest of ultra-low latencies? Are you providing extra interactivity and need to have this work over multiple servers? Will you be working as a completely decentralized CDN with servers constantly being added or removed? More often than not, this is the secret sauce that makes your CDN truly great and the main reason to choose MistServer. The sheer amount of customization and flexibility you will have with MistServer as your backbone allows you to build any type of CDN and make it truly unique. Of course, you don't have to do this alone—contact us and feel free to give us a challenge!