nchan_max_channel_subscribers

Sets the maximum number of subscribers that can connect to a given channel in Nchan.

Syntaxnchan_max_channel_subscribers number;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The nchan_max_channel_subscribers directive specifies the upper limit on the number of concurrent subscribers that can connect to a particular publish/subscribe channel managed by the Nchan module for NGINX. By limiting the number of subscribers, this directive helps ensure that resources are efficiently managed and can prevent any single channel from being overwhelmed by an excessive number of connections. This is particularly useful in environments where bandwidth usage and server performance need to be carefully controlled.

When configured, if the number of subscriber connections exceeds the defined limit, new connections may be rejected, depending on the Nchan module's behavior—that is, either by closing the connection or returning an error to the client. This helps to maintain server performance and stability by preventing resource depletion. It is important to note that setting this parameter too low might hinder the capability of applications relying on Nchan for high-demand event notification systems, whereas setting it too high without proper resource management could lead to server strain.

This directive can be configured within various contexts, such as http, server, or location, allowing for flexible configurations depending on the application's architecture. The value assigned to the directive should be an integer, indicating the maximum number of concurrent subscribers that are allowed.

Config Example

location /pubsub {
    nchan_max_channel_subscribers 100;
    nchan_pubsub;
}

Remember that exceeding the limit may cause subscriber connections to be rejected or delayed.

Carefully evaluate the maximum limit based on your server's capabilities and expected traffic patterns.

← Back to all directives