Ask Your Question
1

What is a more memory efficient method of implementing Redis pubsub for individual users in a Go service?

asked 2022-09-22 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-09-04 04:00:00 +0000

lalupa gravatar image

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.

edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools

Stats

Asked: 2022-09-22 11:00:00 +0000

Seen: 9 times

Last updated: Sep 04 '21