...
This parameter should be set on Transcoder nodes. Also this parameter can be set on Origin nodes, in this case their load can be checked via REST API, and if the Origin node become GROUP_CONNECTION_ALLOWED then new streams can be published to another Origin server.
...
Transcoder node
...
video encoders limiting
If necessary, maximum video encoders simultaneously used amount can be lemited for Transcoder nodes with the following parameter
Code Block | ||
---|---|---|
| ||
cdn_transcoder_forvideo_new_connects_expire_msencoders_threshold=10000 |
In When this case cache timeout is 10 seconds.This amount is reached, the Transcoder node becomes GROUP_CONNECTION_ALLOWED. All the video encoders on server are included, for example, if one stream is transcoding by two profiles, 3 video encoders are used, including PNG encoder.
This parameter should be set on Transcoder nodes.
Origin transcoding overload prevention
The following setting is used to prevent Origin nodes from transcoding streams if no Transcoders available
Code Block | ||
---|---|---|
| ||
cdn_origin_allowed_to_transcode=false |
In this case (by default), if no Trascoders available for new stream by certain profile, this stream will not be played with No available transcoders error.
...
Even Transcoder node load distribution
To distribute streams published to Transcoder nodes evenly, a next available node will be chosen to transcode new stream (Round Robiun algorithm). Stream name caching is used to prevent the same stream requested from couple of clients simultaneously to be spread over a numer of Transcoder nodes. Stream cache timeout is set in milliseconds with the following parameter
Code Block | ||
---|---|---|
| ||
cdn_transcoder_for_originnew_allowedconnects_toexpire_transcode=truems=10000 |
In this case cache timeout is 10 seconds.
This parameter should be set on Edge Transcoder nodes.
Node state checking with REST API
To check node state REST API query /cdn/show_nodes is used
REST query should be HTTP/HTTPS POST request as follows:
- HTTP: http://test.flashphoner.com:8081/rest-api/cdn/show_nodes
- HTTPS: https://test.flashphoner.com:8444/rest-api/cdn/show_nodes
Where:
- test.flashphoner.com - WCS server address
- 8081 - a standard WCS REST / HTTP port
- 8444 - a standard WCS HTTPS port
- rest-api - mandatory part of URL
- /cdn/show_nodes - REST query used
REST queries and responses
...
REST query
...
REST query body example
...
REST response
...
Response states
...
Description
...
/cdn/show_nodes
...
language | js |
---|---|
theme | RDark |
...
Origin transcoding overload prevention
The following setting is used to prevent Origin nodes from transcoding streams if no Transcoders available
Code Block | ||
---|---|---|
| ||
cdn_origin_allowed_to_transcode=false |
In this case (by default), if no Trascoders available for new stream by certain profile, this stream will not be played with No available transcoders error.
Transcoding on Origin nodes can be enabled if necessary
Code Block | ||
---|---|---|
| ||
cdn_origin_allowed_to_transcode=true |
This parameter should be set on Edge nodes.
Node state management with REST API
REST query should be HTTP/HTTPS POST request as follows:
- HTTP: http://test.flashphoner.com:8081/rest-api/cdn/show_nodes
- HTTPS: https://test.flashphoner.com:8444/rest-api/cdn/show_nodes
Where:
- test.flashphoner.com - WCS server address
- 8081 - a standard WCS REST / HTTP port
- 8444 - a standard WCS HTTPS port
- rest-api - mandatory part of URL
- /cdn/show_nodes - REST query used
REST queries and responses
REST query | REST query body example | REST response | Response states | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
/cdn/show_nodes |
| 200 – OK 500 – Internal Server Error | Show CDN nodes state | ||||||||
/cdn/show_node_state |
| 200 – OK 500 – Internal Server Error | Show CDN node state to which the query was sent | ||||||||
/cdn/enforce_node_state |
| 200 – OK 500 – Internal Server Error | Forcefully set CDN node state |
Parameters
Parameter name | Description | Example |
---|---|---|
globalState | Node state: ACTIVE or PASSIVE | ACTIVE |
id | Node address | 192.168.1.64 |
processingState, state | If this node participates in stream playback route elections: NEW_STREAMS_ALLOWED - participates GROUP_CONNECTION_ALLOWED - not participates | NEW_STREAMS_ALLOWED |
role | Node role: ORIGIN, TRANSCODER or EDGE | ORIGIN |
REST query /cdn/show_nodes may be sent to certain node, the node responds with all visible CDN nodes state excluding itself.
REST query /cdn/enforce_node_state allows forcefully change certain node state, for example, exclude the Transcoder node from route elections. To drop enforced state, an emty query body should be passed
Code Block | ||||
---|---|---|---|---|
| ||||
POST /rest-api/cdn/enforce_state HTTP/1.1 Content-Length: 4 Content-Type: application/json |
...
|
...
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
{} |
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
200 – OK
500 – Internal Server Error
...
Show CDN nodes state
Parameters
...
Parameter name
...
Description
...
Example
...
globalState
...
Node state: ACTIVE or PASSIVE
...
ACTIVE
...
id
...
Node address
...
192.168.1.64
...
If this node participates in stream playback route elections:
NEW_STREAMS_ALLOWED - participates
GROUP_CONNECTION_ALLOWED - not participates
...
NEW_STREAMS_ALLOWED
...
ORIGIN
...
Node state definition and broadcasting
Current CDN node state is defined as follows in priority order:
1. If there is a value enforced by /cdn/enforce_node_state REST query, state will be set to this value.
2. If CPU load threshold is reached, state will be set to GROUP_CONNECTIONS_ALLOWED.
3. If video encoders threshold is reached, state will be set to GROUP_CONNECTIONS_ALLOWED.
4. If no limits are reached, state will be set to NEW_STREAMS_ALLOWED.
CDN node broadcasts its state to another nodes periodically, using the interval set in milliseconds with the folowing parameter
Code Block | ||
---|---|---|
| ||
cdn_nodes_state_refresh_interval=60000 |
By default, this interval is 60 seconds. It is recommended to reduce this parameter to 1 second for Transcoder nodes to distribute the streams to another nodes.
CDN nodes authentication
...