nchan_redis_accurate_subscriber_count

The 'nchan_redis_accurate_subscriber_count' directive configures accurate subscriber count tracking when using Redis as a backend for Nchan channels.

Syntaxnchan_redis_accurate_subscriber_count on | off;
Defaultoff
Contextupstream
Arguments1

Description

The 'nchan_redis_accurate_subscriber_count' directive enables or disables the precise counting of active subscribers for Nchan channels when backed by Redis. When set to 'on', this directive utilizes Redis's capabilities to maintain a real-time count of subscribers, ensuring that the number reported is accurate. This is particularly useful in scenarios where scaling is required, as it provides a true reflection of active connections and allows users to monitor usage analytics accurately. When the directive is set to 'off', Nchan may compute estimates based on internal logic or information stored locally, which may not always reflect real-time changes in subscriber status.

This directive works in the 'upstream' context, and it requires one argument value ('on' or 'off'). If you want the subscriber count to be as accurate as possible, you should set this directive to 'on'. Additionally, enabling accurate counts could introduce some performance overhead due to the additional operations involved in updating subscriber numbers in Redis. Nonetheless, the benefits of accurate tracking often outweigh the overhead, especially in applications where subscriber count information forms a basis for scaling decisions or resource allocation.

Config Example

upstream my_nchan_backend {
    nchan_redis_accurate_subscriber_count on;
    server redis_server1;
    server redis_server2;
}

Be cautious of performance impacts when enabling accurate subscriber counts, as this may lead to increased load on Redis.

Ensure that Redis is properly configured and accessible, as failures to connect may lead to incorrect subscriber counts.

← Back to all directives