Scaling Socket.IO with Redis and then scaling Redis itself

Viewed 3457

After using Node.js and socket.io for a while, I understand that if I want my application to support up to 1 million concurrent users I need to scale it, So I started using Redis to PUB/SUB messages between sockets and running a lot of socket.io servers instances, in the same machine and on other machines but all my socket.io servers works with the same Redis server.

This makes me think: what's the point? Will I need a few more redis servers and scale between them? My point is that their will always be a bottleneck on the top server.

My question is, is it possible to scale Redis? And if yes, how will all my sockets that connected to different socket.io server be able to PUB/SUB between the Redis servers?

2 Answers

For further readers, using socket.io with its redis adapter is not scalable (at least for now). Under the hood, redis adapter uses pub/sub to broadcast. Here's a discussion about that: https://github.com/redis/redis/issues/2672

1 thing to highlight: Redis Cluster is not the answer (discussed in the issue above or see youtube link below to get more detail)

I found one interesting solution on scaling Redis pubsub here: https://redislabs.com/wp-content/uploads/2018/04/Redis-Day-TLV-2018-Scaling-Redis-PubSub.pdf

Watch youtube: https://www.youtube.com/watch?v=6G22a5Iooqk&ab_channel=RedisLabs

Related