nchan_message_temp_path
The nchan_message_temp_path directive specifies the temporary file directory for storing messages in Nchan.
Description
The nchan_message_temp_path directive sets the path for temporary storage of messages in Nchan, which can be crucial for applications that require message buffering or need to manage message overflow efficiently. The configured path should be writable by the Nginx process. When messages are published to channels, they may be temporarily stored in files within this directory to relieve memory pressure or to manage high volumes of incoming messages without losing data. Nchan can write messages to the defined path in cases where the in-memory buffer is exhausted.
This directive is particularly useful in scenarios where message persistence is desired and helps prevent message loss when the server is under heavy load. It aids in ensuring that even if consumers are slower than producers, the messages remain accessible up to a specified limit set by this temporary message storage. The location specified by nchan_message_temp_path must have sufficient disk space to accommodate the temporary files for reliable operation.
To utilize this directive effectively, a proper setup of Nginx and permissions to write to the specified directory is recommended. In addition to being set in the http context, it is advisable for any associated data handling mechanisms (like logging or cleaning up old messages) to be well-thought-out to maintain server performance and reliability.
Config Example
http {
nchan_message_temp_path /var/tmp/nchan_messages;
}Ensure the specified path is writable by the Nginx user to avoid permission issues.
Make sure the temporary path has sufficient disk space to handle potential message bursts.
Be aware that storing messages on disk can introduce latency compared to in-memory buffering.