/

Setting Up A New Cluster


To start streaming operations you need to have a minimum of one active cluster (NodeGroup). As described before a cluster will need to have a minimum of one edge and one origin at any given time for a conducting a successful streaming event.

To create a new cluster you need to have access to Stream Manager’s REST API gateway and the Red5 Pro Stream Manager API.

Following are the steps to setup a new cluster (NodeGroup) of Red5 Pro instances.

1. Determine an approximate of your streaming traffic

Before you start creating a cluster, you need to have an approximate figure of what your estimated traffic will be like. Going a step further you should divide you traffic requirement into two types:

  • Base Traffic: Base triffic is the minimum traffic you expect on your setup. The Nodegroup should be able cater to the minimum traffic expected at all times, without needing to scaleup. The base traffic for publishers and subscribers should be evaluated separately.
  • Peak Traffic: Peak traffic is the maximum traffic you expect on your setup. The Nodegroup should be able cater to the maximum traffic expected using autoscaling. The peak traffic for publishers and subscribers should be evaluated separately. As soon as the traffic goes down, autoscaling will remove added nodes automatically to go back to Base Traffic capacity.

Once you have sufficient statistics/idea about your traffic needs you are ready to start creating the nodegroup.

1. Create a launch configuration

As described earlier in this document, a launch configuration file helps in launching a new instance on the target platform. Once you have an idea of the expected Base Traffic and Peak Trafficfor your rig, you can create your launch configuration appropriately.

The launch configuration requires you to specify the prefered instanceType (machine types defined by your platform) and an estimated connectionCapacity for each node type that will be present in your setup.

Each instance type comes with a certain specific configuration as defined by your cloud platform. Red5 Pro supports 4 types of clients based on protocol used for media delivery - RTMP, RTSP, WebRTC and HLS (subscription only). Each of the following client type exerts a different amount of load on the server's CPU, RAM etc. Therefore it is very important to choose the proper instanceType (depending of your expected traffic type, stream quality etc) and configure it with appropriate estimated connectionCapacity in the launch configuration for best results.

Selecting a incorrect instanceType or configuring a improper estimated connectionCapacity may lead to instance crash/failure due to overload or wastage due to underutilization. It is also important to note that the value of connectionCapacity influences auto scaling since it states the maximum capacity of a node.

The estimated connectionCapacity may also widely varies with the node role ie: origin/edge/relay/transcoder.

It is recommended that you contact support for advice on the best instanceType to use and the appropriate estimated connectionCapacity for it based on your streaming needs.

Once you know the best instanceType to use per node type and the estimated connectionCapacity for it, you can create the launch configuration for your nodegroup. To create a launch configuration please check out Stream Manager API for launch configuration management.

2. Create a scale policy

Similar to the launch configuration, the scale policy too plays a pivotal role in guiding autoscaling to meet your traffic needs.

A scale policy requires you to specify the minLimit and the maxLimit per node type that will be used in your setup. The minLimit helps target the Base Traffic, whereas the maxLimit helps with the Peak Traffic.

Determining minLimit and maxLimit for a node type

Consider an example where you estimate that you are going to have a minimum of 900 publishers and your instanceType used for the role of origin has an estimated connectionCapacity of 500, your minLimit for the node type origin should be set to 2. Similarly if you estimate a maximum of 1400 publishers atmost, your maxLimit for the node type origin should be set to 3.

It is always to recommended to have a higher than expected value for maxLimit specified in your scale policy as it will help autoscaling deal with higher than anticipated Peak Traffic effortlessly.

Once you know the best minLimitand maxLimit required per node type, you can create the scale policy for your nodegroup. To create a scale policy please check out Stream Manager API for scale policy management.

3. Create a new NodeGroup

Once you have created a launch configuration and a scale policy for your group, the next step is to create the group itself.

Use the CREATE GROUP REST API call to create a new virtual group name (placeholder) which will define a collection of origins and edges and optionally relays and transcoders as per your launch configuration & scale policy data.Note the group name from the rest response received.

Every group operation requires the group name as the primary parameter.

3. Launch a new origin in the Node Group

Use the LAUNCH NEW ORIGIN REST API call to start a new origin instance in the newly created group created in step 1.

  • The instance normally takes less than 2 mins to be completely initialized and active. This includes time needed for the machine to startup and and time required for Red5 Pro service to be running. (You can optimize the startup time by removing unwanted applications before creating the image).

After the origin is ready it pings Stream Manager over HTTP/HTTPS to discover its Role and acquire initial configuration data. Once the first origin has been initialized, Stream Manager check to see the edge/relay/transcoder requirements using the current state of the group and the scale policy. It then sequentially adds additional nodes to the group as per the scale policy definition using the launch configuration as a guide for launching instances.

Each node upon a successful startup pings Stream Manager over HTTP/HTTPS to discover its Role and acquire initial configuration data. You can start using services as soon as you have a minimum of one origin and one edge in the group. Stream Manager will add more nodes to the group using Autoscaler when it sees the traffic load increasing beyond the configured Threshold or if a node is removed due to failure.

Transcoder nodes although a part of the nodegroup are not a part of the cluster relationship.