I am implementing a Java Spring, Websocket, Redis based notification system (using Redis pubsub). Using Jedis library to work with Redis. I followed this guide to implement the pubsub model - check here
But I am just worried about a few aspects of this design. I need every user connecting to the system to subscribe to a few channels(channels for each user could be different) and listen for messages. Since Jedis' .subscribe() function is a blocking function (kind of wait and watch for messages) we are required to run a new thread for every user/session.
With this design we will be running 15k threads if we have 15k connected users. Is this a good practice ? I believe it's not, so how do we go about implementing a chat/notifications system with so many connected users if the .subscribe() function is blocking and so requires a new thread for every user ?
We have Redis Cluster setup with 3 nodes sharing the 16384 slots. Can Redis handle 15k connections ?
P.S: Im using Redis because I have multiple Application servers running so I can't simply push messages just using Spring websockets. Redis acts as a common channel between all app servers so that every client connected to every app server receives the messages sent.