recv_buf

The recv_buf directive sets the size of the receive buffer for SRT connections in NGINX.

Syntaxrecv_buf size;
Default8192 buffers
Context
Arguments1

Description

The recv_buf directive in the NGINX SRT module specifies the size of the receive buffer used for incoming data on SRT connections. This directive allows the server to allocate a specific amount of memory to manage the data received from SRT streams. The size is defined in bytes and directly influences how the stream data is buffered and processed by the server during transmission.

When a buffer is too small for the incoming data rate, it can lead to dropped packets or degraded performance, as the server cannot process incoming data quickly enough. Conversely, setting the buffer too large may lead to inefficient memory usage. Careful tuning of this value can lead to optimized throughput, especially in high-performance scenarios involving large data transfers over SRT.

The recv_buf directive is particularly useful in scenarios where SRT is utilized for video streaming or data-intensive applications, allowing for better control over data flow and resource management. As with any tuning parameter, it should be set based on the specific use case and the expected traffic characteristics of the application being deployed.

Config Example

srt {
    server {
        listen 4321;
        recv_buf 16384;
        proxy_pass tcp://127.0.0.1:5678;
    }
}

Setting the buffer size too low can cause packet loss during high throughput situations.

If the buffer size is set to an excessively high value, it can lead to increased memory consumption, potentially impacting server performance.

The recv_buf directive must be used within the srt or server block, or it will not take effect.

← Back to all directives