Reputation: 963
So I know that redis is an in-memory data store, but I don't really understand that much about under the hood.
My question is, if I have three separate uses for it, such as python-socketio to enable multiple instances of the socket server, Celery to send tasks to another microservice (which would also use the same redis instance), and just a standard subscriber to listen for notifications to emit, can I use the same redis instance for all three tasks, or will I run into collisions between the different data (i.e celery misinterpreting a call to python-socketio as a task)?
Upvotes: 1
Views: 611
Reputation: 23796
It depends on how your data flows, the question is not clear about how the data flows between each component and their relations.
If there's no relation or dependency between these messages, you can avoid collisions by storing your messages into different DBs in the same redis instance.
Or, in case you need to use the same DB for all of them, you can use namespaces
aka prefixes for your redis keys to make sure there will be no key collisions. Here's more information about how to name keys under Redis keys section.
However this is not scalable to have one instance handling this but still it depends on how much traffic you have and what are you exactly trying to achieve.
Please leave comments in case there's anything not clear or I misunderstood your question
Upvotes: 2