kmp_rtmp_out_timeout

The `kmp_rtmp_out_timeout` directive specifies the timeout duration for outgoing RTMP connections in the Kaltura Media Framework.

Syntaxkmp_rtmp_out_timeout timeout;
Defaultnone
Contextstream, stream server
Arguments1

Description

The kmp_rtmp_out_timeout directive is used within the context of a stream or stream server block in NGINX to define the maximum duration that an outgoing RTMP (Real-Time Messaging Protocol) connection can remain open if no data is transferred. By setting this timeout, we can ensure that inactive connections do not persist indefinitely, which helps in managing resources efficiently and prevents potential service disruptions due to hanging connections.

The directive takes a single argument that specifies the timeout duration in seconds. For instance, setting kmp_rtmp_out_timeout 30; means that if no data is sent over the outgoing RTMP connection for 30 seconds, the connection will be automatically closed. This behavior is particularly beneficial in live streaming scenarios, where maintaining a healthy number of connections is crucial for performance, and unexpected or malicious hold-ups can degrade overall service availability.

When the timeout elapses, NGINX will terminate the connection quietly, thus freeing up resources for other requests or clients. It's important to note that this timeout applies to all outgoing RTMP connections handled by the module, ensuring a uniform handling of idle connections across the media streaming setup. Therefore, careful consideration should be given when setting this value, balancing between maintaining connections for expected activity and freeing resources during inactivity.

Config Example

stream {
    server {
        listen 1935;
        kmp_rtmp_out_timeout 60;
    }
}

Setting the timeout too low may cause legitimate connections to drop, especially for longer-running streams.

If the directive is not set, outgoing connections may hang indefinitely, leading to resource exhaustion.

← Back to all directives