live_kmp_read_timeout
The `live_kmp_read_timeout` directive sets the timeout duration for reading Kaltura Media Protocol (KMP) streams.
Description
The live_kmp_read_timeout directive specifies the maximum amount of time that the NGINX server will wait while attempting to read data from a Kaltura Media Protocol (KMP) stream. This is particularly relevant for ensuring that stream reading does not hang indefinitely, which can be problematic in a production environment where stream reliability and server responsiveness are critical. The directive accepts a single argument which is a time value in seconds, enabling administrators to define how long the server should block while waiting for data before giving up and closing the connection.
When configuring this directive, it's important to consider the nature of the streams you are working with. Streams under normal operation may have delays, and setting this timeout too low might cause premature disconnections. On the other hand, a value set too high may lead to resource wastage if the stream is genuinely inactive. Therefore, it's advisable to monitor the specific conditions and adjust the timeout value accordingly.
Another aspect to consider is the context of this directive; it can be used in both 'stream' and 'stream server' contexts. The flexibility allows for precise control over the stream reading behavior at different levels of the NGINX configuration hierarchy.
Config Example
stream {
server {
listen 1935;
live_kmp_read_timeout 30s;
}
}Setting the timeout too low may lead to frequent disconnections from the stream, while too high a value may reduce server performance due to idle connections. Make sure to benchmark and adjust accordingly.
This directive applies only to KMP streams; using it in contexts unrelated to KMP may lead to undefined behavior.