Designing infrastructure for video streaming – hardware

By Szymon PolokNovember 27, 2021
video streaming hardware

This post is also available in: polski

We already know what kind of software we need to support video streaming. It’s time to talk about the hardware architecture required for our service to function efficiently and reliably. As in the case of software, we will first deal with the streaming device. We already know that it can be virtually any electronical device, but there are a few essential aspects to keep in mind.

Performance

First, it doesn’t matter whenever we are dealing with a smartphone or a PC/MAC computer – it’s the performance that is important. Most modern devices based on either ARM or x86 architecture have dedicated instruction sets that make image “decoding” fast and efficient. Unfortunately, this does not mean that the image “encoding” process is also supported in the hardware layer. This is often not the case unless we have a dedicated graphic card or the appropriate processor type. Nevertheless, even with good quality equipment, we may encounter difficulties trying to encode an image into 4k resolution. One of the things that many people are not aware of is the fact that virtually all modern devices are equipped with technologies that lower the clock speed of the processors when certain thermal limits are reached. In other words, if our phone or computer “encodes” our stream for a long time, its performance may drop due to the amount of generated heat. This problem primarily affects phones that do not have active cooling systems and for which thermal limits are several times lower than in the case of laptops or desktop computers. A classic PC/Mac processor can heat up to 100 degrees Celsius. Mobile phones also defend themselves against heigh power consumption from a battery, which further reduces performance. Not being aware of these processes, you can get into the situation that in the case of long streaming sessions, the image will start to jerk because the streaming device will not generate the required number of frames per second. It is always a good idea to connect your phone to power for long sessions too, but additional cooling might be needed too.

Transfer speed

While the performance is our first issue, the next is data transfer process that generates a lot of further possible complications. To broadcast the image in FullHD resolution, as mentioned earlier, we need a transfer speed of about 5-7 Megabits per seconds. It can be a slightly larger or smaller number depending on what is happening on the screen. A soccer game will use up more bandwidth than a boring psychology lecture. Nevertheless, we need to deliver this signal to the streaming server with the lowest possible latency and without any packet loss. However, this is not always possible. Depending on the type of Internet (fiber optic, mobile LTE), the required upload may be impossible to obtain. Many telecommunications companies offer their customers high-speed Internet of 100 Megabits/s or more, but this value only applies to “download” speed, not the upload speed. The latter is very often even 1/10 of the base one. So having, for example 50 Megabits/s Internet connection, might give us upload speed of about 5 Megabits per second. Mobile networks are additionally burdened with a huge variability of transmission speed. At a given moment, we can have 25 Megabits/s of upload, and after a while, we have only one or less. This situation results directly from the number of people connected to a given broadcasting station and often depends on the actual hour.

Internet stability

Internet speed alone is not the only issue – its stability is critical as well. Let’s say that an internet connection would lose about 5% of packets. For an ordinary user, it is practically unnoticeable. Regular web pages are just a few megabytes in weight. The impact of such losses on for example Netflix movie download, is also tiny. Before we get to the downloaded video fragment, the system will automatically download the data again, and we will not even notice that something bad has happened. In the case of video streaming, this is not the case, and any loss of the package can cause stutter or errors in the movie, especially if the streaming is profiled for very low delays, such as auctions or online shopping. Therefore, it is essential to analyze the entire signal path from the streaming device, often through the wi-fi network, the local Internet provider, to the hosting company. Errors and delays on any of these elements can significantly affect the final experience for viewers on the other side.

Streaming server

Okay, the signal reached at this point our server with the streaming application installed, but what’s next? First of all, we highly advise picking up a good hosting company with multiple internet providers. In the event of a failure of a given network link, traffic will automatically go through another one. Therefore, at this stage, we can say that a “homemade server closet” placed in the office will not meet our expectations and will be a source of constant problems. However, this does not mean that each hosting company will offer us such a network redundancy. Here you will have to try to get a dedicated offer for our venture.

Staying somewhat further in network matters, we can focus on server hardware. When buying our own servers or renting them for a specific period, we should ensure several parameters of such a machine or machines. The first item is the network card. Today, most servers are still equipped with one or more Ethernet links. Each of them offers a bandwidth of 1Gbps or 1024 Megabits per second. A single streaming server with such a connection will be able to accept a maximum of about 140 streams in FullHD resolution (1024/7 = 146.28). If we only have one server, we can serve the same number of viewers. It’s relatively not a lot. However, we can equip the machine with 10Gbps links, which increase these values ​​ten times. In this case, we already have around 1,400 viewers or incoming streams. Other server components, such as the Processor or Ram, must also enable us to work with the fullest possible performance. When selecting the hardware, we recommend configurations consisting of 2-processors (a total of about 32 cores) and 256GB of Ram. This arrangement will allow us to use a single 10Gbps link without any problems.


Tags: streaming performance, streaming server