Redis pub sub max subscribers and publishers

余生颓废 提交于 2020-06-17 01:56:39

问题


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


回答1:


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).




回答2:


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



来源:https://stackoverflow.com/questions/59873784/redis-pub-sub-max-subscribers-and-publishers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!