Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

socketio and redisstore scaling efficiency

socketio and redisstore scaling efficiency

Problem

I am working on a pretty big project that involves sending data between clients. So, I am just researching on some new technologies out there. Anyways, thought I'd give Nodejs a try. I just have a question about Socketio and redis.

When we are using the pub/sub functions in socketio, does every client Connection create a new connection to redis? Or, does socketio use a max of create three connections (in total, regardless of the number of clients) to do the pub/sub stuff?

Problem courtesy of: States

Solution

From the source, it seems that each client connection has two associated subscriptions to Redis (this.store in the code), but that each socket.io server has only three connections to Redis (source).

this.store.subscribe('message:' + data.id, function (packet) {
  self.onClientMessage(data.id, packet);
});

this.store.subscribe('disconnect:' + data.id, function (reason) {
  self.onClientDisconnect(data.id, reason);
});

Redis should be able to handle a lot of connections as well as subscriptions, but benchmarking is recommended as always.

Solution courtesy of: Linus Gustav Larsson Thiel

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

socketio and redisstore scaling efficiency

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×