I just got started with Redis and i’m trying to understand how does it work, so i apologize if what i’m gonna say is not correct.
I want to build a real time system where a Python application (which we will call Data Collector) retrieves stock market trades from around 600 markets. Those trades should be sent to a Django application and shown on the frontend in real time, so i would have Python retrieves the trades > Django receives them and sends them to the page.
Basically i would use Redis as a message broker, it would be a PUB/SUB system. So the Data collector is always running, it retrieves the trades and sends them to the channel; there is one channel for every market (600+). On the Django side, as soon as the user opens the page of market XYZ, Django will connect to the Redis channel of market XYZ and get the trades for that channel. Keep in mind that none of this data needs to be stored, it just needs to be shown on my frontend.
That system should work, on paper, the only thing giving me doubts is the large number of channels, in this case. Would Redis support a really high number of channels? Or does it not depend on how many channels i create? Should i just look for another way to do it?
3
Answers
It totally depends on your server configuration.
A part from number of channel there are other things to consider like number of concurrent socket connection through client browser.
you can refer the below link to understand working of pub/sub in detail
here
As previously answered here: Redis pub sub max subscribers and publishers
There is no hard limit in Redis on maximum number of channels; it is user configurable.
In order to find the maximum number of channels for your realtime requirement, you need to perform latency profiling and find a agreement on [ number of channels vs your desired latency] . It would be not wise to go with maximum number of channels from intuition as it might not provide fruitful result for your requirement.
Here is a small discussion on redis channels/latency profiling.
Additionally, apart from above you have following two choices to improve performance if required, those are