max_streams
The 'max_streams' directive limits the maximum number of concurrent streams that can be handled by an RTMP application in the NGINX RTMP module.
Description
The 'max_streams' directive is used in the NGINX RTMP module to define the upper limit on the number of simultaneous RTMP streams that can be managed by a specific application. By imposing this limit, it helps maintain performance and stability on the server under high loads, preventing excessive resource consumption that could destabilize the streaming service.
When setting the 'max_streams' directive, the argument must be a positive integer indicating the maximum number of streams. If the current number of active streams reaches this limit, any new incoming stream requests will be refused until the active stream count falls below the specified threshold. This allows server administrators to implement a control mechanism ensuring that system resources are not exhausted during peak usage times.
It is important to consider the capacity of the server's hardware when configuring this directive, as setting 'max_streams' too low may hinder the service's usability, while setting it too high could lead to server overloads. Proper testing and monitoring should be conducted to find the optimal value for this directive as per the use case requirements.
Config Example
application live {
live on;
max_streams 100;
}Ensure that the number specified does not exceed server capabilities, as this can lead to dropped connections or degraded performance.
Remember to adjust 'max_streams' according to the expected traffic load and available server resources.