4
votes

I have a problem scaling my Node.js app on heroku. I am using RedisStore to keep my socket connection persistent between node processes. I am scaling to 2, 3 processes. I followed this code here https://gist.github.com/1391583. Everything works fine on one process, but when I scale out, broadcasts do not reach other nodes. Connection info is persistent however, and I do not get constant handshake errors and disconnects.

My understanding is that socket.io RedisStore also handles the redis Pub/Sub internally to keep multiple processes in-sync. As mentioned here https://groups.google.com/forum/?fromgroups&hl=en#!topic/socket_io/gymBTlruYxs And by the way, I applied the #848 socket.io patch, it did not seem to fix the problem for me.

As of May 14, 2012, Heroku supports only xhr-polling transport for socket.io, which is what I am using. So is this problem with long polling only? Is there a work-around for this?

Thanks in advance.

2

2 Answers

1
votes

Sorry if this is completely irrelevant, but when I see a problem that needs scalability, node, redis and pub/sub, I think of Beseda - is this something you should be looking into?

0
votes

I solved this by implementing my own Redis layer. I had all the Node servers that where deployed on different instances subscribe to a central Redis server, and listen to messages from Redis instead of the sockets. It worked for websockets, and xhr polling.