push_subscriber_concurrency
The `push_subscriber_concurrency` directive limits the number of concurrent push subscribers per channel in the NGINX Nchan module.
Description
The push_subscriber_concurrency directive is used to control the maximum number of concurrent subscribers that can receive push notifications from a specified channel. This is particularly useful for optimizing resource consumption and managing server load in environments with many simultaneous connections. When set, it prevents more subscribers than the defined limit from being able to connect to the push channel, effectively enforcing subscriber concurrency on a per-channel basis.
This directive can be applied in various contexts such as server, location, and if within a location block, allowing for flexible configuration tailored to specific routes or server setups. When the limit is reached, additional subscribers may be refused or placed in a queue, thus ensuring stability and performance under high loads. As with many directives in the Nchan module, proper tuning of this value is essential for balancing user experience and server resource management.
Setting the push_subscriber_concurrency directive requires an integer argument specifying the allowed number of concurrent subscribers. If the value is set too low, some legitimate subscribers might be unable to connect, while a value set too high may lead to overloading the server resources, resulting in degraded performance.
Config Example
location /push {
push_subscriber_concurrency 10;
nchan_pubsub;
}Ensure the concurrency limit aligns with the server capabilities to avoid dropping legitimate subscriptions.
Test under load to determine an optimal concurrency setting that maintains service integrity without sacrificing performance.