Could anyone tell me whats the maximum number of concurrent channels Redis pub-sub can support?. Is there any cap to the number of subscribers and publishers
Could anyone tell me whats the maximum number of concurrent channels Redis pub-sub can support?. Is there any cap to the number of subscribers and publishers
2
Answers
Pub/Sub
clients have a default hard limit of 32 megabytes and a soft limit of 8 megabytes per 60 seconds.Is that what you have been looking for?
documentation
Redis uses a
dict
, same struct as for keys, to store channel subscriptions, both per client and for all clients (keeps a per-subscription hash with a list of clients subscribed), so it is up to 2^32 channel subscriptions in total.It uses a list to store pattern subscriptions per client, so it is theoretically limited only by the node memory available.
However, in general, you can have infinite channels. Think of a channel as a label when a message is published. Messages are never stored. When the message is published, Redis will look for the clients subscribed to that channel, and test for every pattern subscription. The channel really exists only while the message is being published.
As there are pattern subscriptions, there are unlimited ‘logical’ channels.
Just in events notifications we have 2^32 * databases * key event types possible ‘logical’ channels.
Regarding the number of subscribers and publishers, it is limited by the
maxclients
setting, 10,000 by default. There is no limitation for subscribers and publishers, but the maximum clients (connections) limit applies.As indicated by @Roman, there are buffer limitations, but this refers mostly to throughput (message processing).