Red5 Documentation

Relay Nodes

Origin and Edge Nodes

In a simple nodegroup/cluster, the origin and edge roles are pretty straight forward:

  • Broadcasters are directed to the origin server(s)
  • Subscribers are directed to the edge server(s)

Example: Nodegroup created with one origin and one edge server.

  • origin server connectionCapacity set to 50. Alarm threshold set to 60% (default).
  • edge server connectionCapacity set to 400. Alarm threshold set to 60% (default).

Let’s say this is a one-to-many scenario. So, one broadcaster/one stream.

When there are 241 subscribers, the stream manager will add a second edge server. New connections will be directed to whichever edge server has the least connections. To start, that will definitely be the new edge server, but some of the original subscribers might drop off, and at some point the traffic will be more evenly balanced between the two edge nodes. If at some point the second edge server reaches 241 connections, then a third edge server will be spun up, and so on until you reach the maxLimit defined in your scaling policy. When your subscribers drop off, or your broadcast ends, the nodegroup will scale back down, ultimately to the defined minLimit.

If the edge server reaches 400 connections, the defined connectionCapacity, the stream manager will no longer send any new connections to that server.

Note: edge servers will not be spun down if they have any active connections.

Relay Nodes

Relay servers are recommended for the use case of one (or a few) broadcasters to many subscribers. They are basically repeaters which boost the signal of the broadcast.

If you expect a large number of subscribers/edge nodes, then you will want to include at least one relay node in your launch configuration (there must be at least one relay in place in order for the relay nodes to scale).

When you set the maxLimit for your edge servers, you should divide that by your edge connectionCapacity to determine the maximum number of relay servers that you will need. If your minLimit value fo your edges is higher than the connection capacity of a single edge node, then you will need more than one relay node.

Example: As with the above, this is a one to many scenario, but it’s for a large event. One broadcaster/one stream, but over 1,000,000 subscribers.

  • origin server connectionCapacity set to 50.
  • edge server connectionCapacity set to 400.
  • Given the connection capacity of the edges, we would need 2,500 edge servers to support 1,000,000 subscribers. 2,500/400=6.25, so we will want to have 7 relay servers in total.

NOTE: the relay connection capacity, for autoscaling, is based on the number of edges connected to it.

See this document for more details on the importance of using relay nodes for large-scale streaming environments.