NOTE: the initial version of the Node.js checker can only be used for an environment with a single nodegroup. If you have multiple nodegroups in your environment then do not implement the Node Checker at this time.
The Node Checker is a stand alone Node.js server which can be deployed along-side a Red5 Pro Autoscaling environment to monitor the Red5 Pro edges and guarantee that WebRTC is working for all of them. If a problem is found on a certain edge, the Node Checker will report it to the Stream Manager so that will stop forwarding new clients to it. Moreover, a new edge instance will be created to compensate for the loss in capacity. When an edge is reported, the Stream Manager will monitor its existing clients and once all of them disconnect, the Stream Manager will proceed to terminate the edge.
The Node Checker checks the health of the edges by periodically retrieving the list of inservice edges using the Stream Manager API and the list of published streams. If at least one edge and one stream are found, a live stream is randomly selected from the list and an attempt is made to subscribe to that live stream using every edge.
The health check is run on a single live stream because it has been observed that when an edge is unresponsive for one stream, it is unresponsive for the others as well
The subscribe attempt consists of having the Node Checker launch a Google Chrome instance which will load a locally served HTML5 page. The URL of the page will include the IP of the edge server to use and the stream name to subscribe to along with the maximum number of retries. Once the page can successfully subscribe, or it reaches the maximum number of retries, it will call a REST API exposed by the Node Checker to inform it whether it was able to subscribe or not. If the Node Checker is informed that the page could not subscribe, or the page does not repond within a maximum timeout, the Node Checker will flag the edge as unresponsive and after a configurable number of unresponsive health checks, the Node Checker will report the unresponsive edge to the Stream Manager using the sunset node API.