respawn_timeout

The 'respawn_timeout' directive in the NGINX RTMP module configures the time duration to wait before attempting to respawn a stream after it fails.

Syntaxrespawn_timeout time;
Defaultnone
Context
Arguments1

Description

The 'respawn_timeout' directive is utilized in the context of the NGINX RTMP module to manage stream failures effectively. When a streaming session encounters an issue, this directive specifies the duration (in milliseconds) that NGINX should wait before it attempts to restart (or respawn) the stream. This can be particularly useful in scenarios where streams may temporarily fail due to network issues or other transient errors, allowing for a grace period before re-establishing the connection.

The value set for 'respawn_timeout' is crucial as it mitigates the risks associated with rapid restart attempts that might overwhelm the server or lead to cascading failures. By providing a reasonable timeout, administrators can ensure that streams have adequate time to stabilize before being restarted. This directive is particularly relevant in high-availability streaming environments where reliability is paramount.

Furthermore, users should note that this directive is only applicable in specific stream processing contexts and is not usable across all server or application configuration contexts. Proper placement within the relevant blocks in the NGINX configuration file is essential for it to function as intended.

Config Example

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            respawn_timeout 5000;
        }
    }
}

Setting 'respawn_timeout' too low may lead to excessive CPU usage due to rapid respawn attempts.

Ensure the directive is placed within an appropriate application context or it will not take effect.

← Back to all directives