• Load balancing overview

    When two or more media servers are used together in a cluster, a load balancer is used to distribute the load between each media server. Load balancing is an essential part of any streaming solution that uses more than one media server for playback. There are various types of load balancing solutions and these can be used on their own or combined, depending on how large and distributed the media cluster is. Depending on the type of streaming, some load balancing solutions are better than others. Your workflow and type of streaming will dictate which is the best choice for you.


    Load balancing requirements
    Load balancing types
    More resources

    Load balancing requirements

    A load balancer suitable for balancing media servers should have as many of the following requirements as possible:

    • Add or remove media servers easily from the cluster. Ideally, this would be automatic so that server failures could be detected easily.

    • Handle persistent and non-persistent connections. Persistent connections would be connections to other Wowza media servers or to Wowza GoCoder™) over WOWZ™ and RTMP protocols. Non-persistent connections would be most HTTP connections and RTMPT connections.

    • Determine the load on all media servers in the cluster so that accurate balancing decisions can be made.

    • Handle server failures quickly and efficiently.

    • Don't disrupt or delay the stream traffic.

    Load balancing types

    Wowza Load Balancer

    Wowza Load Balancer is a free AddOn that can be run on any Wowza Streaming Engine™ media server. It consists of two parts. A Listener runs on a Wowza media server that's designated as the Load Balancer, which receives the initial player requests and automatic status updates from the Wowza media servers in the cluster servers. A Sender runs on each of the media servers in the cluster and sends current load information to the Listener.

    When a player connection is made, it initially connects to an application on the Listener. The connection is automatically redirected, using a standard 302 redirect, to the correct media server in the cluster. The player then disconnects from the Listener application and connects to the streaming application on the media server to which it is redirected. In order for this to work, the player must be able to handle the 302 redirect, which may limit the players that can be used. For players that can't handle the redirect, there's an HTTP interface that can be called to get the current redirect address.

    Wowza Load Balancer won't work with encoders that can't handle the redirect. So if balancing encoder connections is needed, a different solution may have to be used.

    Because Wowza Load Balancer is built on top of Wowza Streaming Engine software, you can extend it by using custom Java classes to allow for very fine control over how the connections are balanced.

    Round-robin DNS and Geo-based DNS load balancers

    Domain Name System (DNS) servers that support round-robin DNS or Geo-based DNS can be used in some cases to load balance media servers. They usually work adequately for persistent connections, but sometimes cause problems for non-persistent connections. This is because a non-persistent connection performs a new DNS lookup for every request and may receive an address for a different server when it reconnects. DNS-based load balancing only provides rough balancing to the server cluster because there isn't any way for the DNS server to know what the current load is on the clustered servers. Also, the built-in caching mechanism associated with DNS can cause some servers to receive more connections than others. If a failure occurs, it may not be detected until the cached DNS request expires.

    Third-party load balancers

    Most third-party load balancers work by forwarding the TCP or UDP packets from client-side connections to the correct media server in the cluster, similar to how a router forwards packets on a network. All of the network traffic from the client runs through the load balancer. Some load balancers have different options for the traffic returning from the server cluster to the client. In most cases, this traffic consists of large media packets, so care must be taken to select an option that doesn't cause the load balancer to delay the returning traffic.

    Because all traffic from the client side passes through the load balancer, the load balancer can monitor the load on the media server cluster fairly accurately. Separate monitoring of the cluster is used to detect failures.

    Normally, the load balancer is completely transparent to the client application; however, care must be taken when configuring the load balancer for non-persistent connections to ensure that the connections are always redirected to the correct media server. In most cases, there's a setting to handle these.


    • In some cases, it may be beneficial to use multiple load balancing types. For example, round-robin DNS could be used to direct connections to a pair of Wowza load balancers or third-party load balancers that are then used to balance the actual media server cluster.

    • Geo-based DNS load balancers could be used to send connections to a specific data center where Wowza load balancers or third-party load balancers are used.

    • Either DNS-based load-balancing method could also be used to distribute encoder connections to multiple origin media servers.

    More resources

    How to get Dynamic Load Balancing AddOn

    Originally Published: For Wowza Streaming Engine on 01-13-2015.

    If you're having problems or want to discuss this article, post in our forum.