push_min_message_buffer_length

Sets the minimum buffer length for messages in Nchan's pub/sub implementation.

Syntaxpush_min_message_buffer_length number;
Defaultnone
Contextserver, location, if in location
Arguments1

Description

The push_min_message_buffer_length directive defines the minimum size for the buffer that stores messages being published in the Nchan module for NGINX. This directive is essential for ensuring that messages are buffered adequately before they are sent to subscribers, which can be crucial in scenarios that demand high throughput and low latency.

When configuring push_min_message_buffer_length, the specified value represents the number of bytes reserved for message buffers. If a message being published exceeds this length, the buffer must be updated, potentially affecting the performance and memory usage. Thus, it's important to set an appropriate buffer size that balances resource consumption with the application's needs. By managing buffer sizes effectively, you can enhance message delivery reliability across varying network conditions and subscriber loads.

This directive applies in server and location contexts as well as within if blocks in a location block, allowing for flexible configurations tailored to different routing paths in your application. Furthermore, tuning this directive can help optimize the performance of Nchan in both standalone and clustered deployments, ensuring smooth operation as the load increases.

Config Example

location /pubsub {
    push_min_message_buffer_length 1024;
    # additional configurations
}

Setting the buffer size too low may result in dropped messages during high load.

Exceeding the available memory can lead to application instability if buffer sizes are not managed correctly.

← Back to all directives