One method would be to use a single Redis channel for all users and use the username as a prefix for the messages. This way, subscribers can filter out only the messages meant for them using the prefix. This reduces the number of channels needed and the amount of memory used by Redis. Additionally, the subscribers can use a Redis list to store the messages meant for them, rather than keeping a live connection to the Redis server. This reduces the number of active connections and the memory needed by the subscriber. Another approach would be to use a different messaging system or protocol that is more lightweight and memory efficient, such as RabbitMQ or MQTT.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-09-22 11:00:00 +0000
Seen: 9 times
Last updated: Sep 04 '21