nchan_group_max_subscribers

Limits the maximum number of subscribers to a specific pub/sub channel in Nchan.

Syntaxnchan_group_max_subscribers number;
Defaultnone
Contextlocation
Arguments1

Description

The nchan_group_max_subscribers directive controls the maximum number of concurrent subscribers that can connect to a single pub/sub channel. This is a crucial setting for managing resources and ensuring fair usage of the server, especially in high-traffic applications where numerous clients may attempt to connect to the same channel simultaneously.

When this directive is configured in the location context, it takes a numerical argument that specifies the maximum number of subscribers allowed. If the number of concurrent subscribers exceeds this limit, new connection attempts will be rejected, preventing potential overloading of resources and maintaining the overall performance of the Nchan server. This configuration helps in building scalable applications that need to handle varying loads without crashing or slowing down due to excessive connections on a single channel.

Properly setting the nchan_group_max_subscribers value is essential for optimizing system performance. If set too low, legitimate users may be unable to connect, while setting it too high can lead to resource exhaustion. Therefore, it's recommended to analyze expected traffic patterns and usage when configuring this directive in production environments.

Config Example

location /pubsub {
    nchan_pubsub;
    nchan_group_max_subscribers 100;
}

Setting this to a very low number may disrupt service for actual users trying to connect to the channel.

If not set, the default is no limit, which could lead to resource exhaustion under heavy load.

← Back to all directives