Jump to content

GstNetBalancer/User Guide: Difference between revisions

m
no edit summary
mNo edit summary
Line 1: Line 1:
<noinclude>
<noinclude>
{{GstNetBalancer/Head|previous=|next=|}}
{{GstNetBalancer/Head|previous=Getting Started/Building and installation guide|next=Examples}}
</noinclude>
</noinclude>


Line 8: Line 8:


The netbalancer element is used for flattening the data transmission curve of a network in order to get the most out of a connection.
The netbalancer element is used for flattening the data transmission curve of a network in order to get the most out of a connection.
This is achieved by introducing dynamic delays between packets; the element keeps track of the amount of data that has transmitted in a limited time frame. In case a new package wants to be sent but the data cap for that time frame has already been reached, then the packets are delayed until a new time window starts. This ensures that the data transmission is always under a specified bandwidth.
This is achieved by introducing dynamic delays between packets; the element keeps track of the amount of data that has been transmitted in a limited time frame. In case a new package wants to be sent but the data cap for that time frame has already been reached, then the packets are delayed until a new time window starts. This ensures that the data transmission is always under a specified bandwidth.
   
   
The netbalancer does not modify the contents of any of the packets or the way they are sent. The characteristics of the packets remain the same; the only thing that varies is the rate at which these packets enter and exit the element pads. The netbalancer then does not replace any of the elements in a pipeline; it is not intended for packaging data nor send it over a network. A netbalancer element is usually added at the end of the streaming pipeline; just before an <code>udpsink</code> or <code>rtspsink</code> element, but can be added anywhere where the packet rate wants to be controlled.   
The netbalancer does not modify the contents of any of the packets or the way they are sent. The characteristics of the packets remain the same; the only thing that varies is the rate at which these packets enter and exit the element pads. The netbalancer then does not replace any of the elements in a pipeline; it is not intended for packaging data nor sending it over a network. A netbalancer element is usually added at the end of the streaming pipeline; just before an <code>udpsink</code> or <code>rtspsink</code> element, but can be added anywhere where the packet rate wants to be controlled.   


An ideal use case for the netbalancer element happens when there are spikes of data transmitted in a very small time frame; meaning that the network load is not constant, so it is heavily stressed for a short time and idle the rest of the time.  
An ideal use case for the netbalancer element happens when there are spikes of data transmitted in a very small time frame; meaning that the network load is not constant, so it is heavily stressed for a short time and idle the rest of the time.  


A real world example for this is the transmission of compressed video where I-frames are significantly larger so they periodically stress the network and these frames don't need to be immediately available on the receiver since the stream works at a fixed framerate. The netbalancer can space out the packets that make up the I-frames and send them at a pace that alleviates the network and keeps the framerate requirements.  
A real world example of this is the transmission of compressed video where I-frames are significantly larger so they periodically stress the network and these frames don't need to be immediately available on the receiver since the stream works at a fixed framerate. The netbalancer can space out the packets that make up the I-frames and send them at a pace that alleviates the network and keeps the framerate requirements.  


The following image represents the netbalancer theoretical functionality:
The following image represents the netbalancer theoretical functionality:
Line 25: Line 25:


* '''bandwidth''': defines the maximum desired bandwidth in kbps.
* '''bandwidth''': defines the maximum desired bandwidth in kbps.
* '''distribution_factor''': defines the number of intervals in a second used to fine control the bandwidth. Larger number produces more distributed data but a too large value can add extra delays not required.
* '''distribution_factor''': defines the number of intervals in a second used to fine control the bandwidth. A larger number produces more distributed data but a too large value can add extra delays not required.
* '''min_delay''': add a minimum delay between each pair of consecutive packets.
* '''min_delay''': add a minimum delay between each pair of consecutive packets.


You can adjust this properties to fit you network and stream conditions.
You can adjust these properties to fit your network and stream conditions.


In general the netbalancer will distribute the bandwidth between the intervals, allowing only to send a portion of the bandwidth in each interval. If the stream provides more bytes that the bytes assigned to an interval time, the netbalancer will wait until the next interval to send them.  
In general, the netbalancer will distribute the bandwidth between the intervals, allowing only to send a portion of the bandwidth in each interval. If the stream provides more bytes than the bytes assigned to an interval time, the netbalancer will wait until the next interval to send them.  


Also you can define a minimum delay between packets to have minimal uniform distribution.
Also you can define a minimum delay between packets to have a minimal uniform distribution.


The complete list of properties for the netbalancer can be seen using the following command:
The complete list of properties for the netbalancer can be seen using the following command:
Line 44: Line 44:


==== The bandwidth property ====
==== The bandwidth property ====
This property is set based on the network capabilities; however, in most cases this parameter by itself is not enough to balance the transmission.
This property is set based on the network capabilities; however, in most cases, this parameter by itself is not enough to balance the transmission.


As shown in figure 1 both cases A and B have the same bandwidth and transmit the same amount of bytes per second; however, the network load is distributed in two very different patterns. This is where the distribution factor comes into play.
As shown in figure 1 both cases A and B have the same bandwidth and transmit the same amount of bytes per second; however, the network load is distributed in two very different patterns. This is where the distribution factor comes into play.


==== The distribution_factor property ====
==== The distribution_factor property ====
This property splits the bandwidth specified for a second into smaller intervals. This allows to limit the transmission with more control while keeping the same bandwidth.
This property splits the bandwidth specified for a second into smaller intervals. This allows limiting the transmission with more control while keeping the same bandwidth.


Figure 1 A has a distribution factor of <code>30</code>, which means that the <code>1.34Mbps</code> is not limited as <code>1.34Mb = 167500B</code> every <code>1s</code>, but instead it is limited as <code>5600B</code> every <code>33ms</code>.  
Figure 1 A has a distribution factor of <code>30</code>, which means that the <code>1.34Mbps</code> is not limited as <code>1.34Mb = 167500B</code> every <code>1s</code>, but instead it is limited as <code>5600B</code> every <code>33ms</code>.  
Line 55: Line 55:
Figure 1 B takes this even further, instead of being limited to <code>5600B</code> every <code>33ms</code> this one uses a distribution factor of <code>120</code> so it divides the previous intervals into fourths; meaning that the bandwidth is seen as <code>1400B</code> every <code>8.25ms</code>.
Figure 1 B takes this even further, instead of being limited to <code>5600B</code> every <code>33ms</code> this one uses a distribution factor of <code>120</code> so it divides the previous intervals into fourths; meaning that the bandwidth is seen as <code>1400B</code> every <code>8.25ms</code>.


Notice how all of this configurations still keep a <code>1.34Mbps</code> bandwidth but the overall behavior and limitations are different.
Notice how all of these configurations still keep a <code>1.34Mbps</code> bandwidth but the overall behavior and limitations are different.


==== The min_delay property ====
==== The min_delay property ====
This property is used to add a minimum separation between packets to make sure they are distributed properly. It is useful since a time window will likely have multiple packets in it and it is not realistic to have a packet per window. Adding this delay requires you to know the maximum number of packets in each window. If a worst case scenario means that every <code>33ms</code> window will have <code>10</code> packets. Then a delay of <code>33ms/10</code> can be added so that all packets still fit into that frame but are evenly distributed. This is done for a worst case scenario because otherwise the delays would push packets out of their expected time window.
This property is used to add a minimum separation between packets to make sure they are distributed properly. It is useful since a time window will likely have multiple packets in it and it is not realistic to have a packet per window. Adding this delay requires you to know the maximum number of packets in each window. If a worst case scenario means that every <code>33ms</code> window will have <code>10</code> packets. Then a delay of <code>33ms/10</code> can be added so that all packets still fit into that frame but are evenly distributed. This is done for a worst case scenario because otherwise, the delays would push packets out of their expected time window.


== Examples ==
== Examples ==
Line 64: Line 64:


<noinclude>
<noinclude>
{{GstNetBalancer/Foot|previous=|next=|}}
{{GstNetBalancer/Foot|Getting Started/Building and installation guide|next=Examples}}
</noinclude>
</noinclude>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.