I try to scale my socket.io application and try to run several processes on my server.
I use redis store instead of memory store as described here: https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO
My server listens to port 8090:
var io = require(‘/usr/local/lib/node_modules/socket.io’).listen(8090);
When I start a second process, I get an address in use error:
warn – error raised: Error: listen EADDRINUSE
What’s the best way handle this issue?
A port for each process and a load balancer to distinguish between them?
Or is there a better solution?
For this I use node-http-proxy, and route the traffic to internal ports based off of the URL being requested. Below is a very stripped down example of what I am using to route requests.
More details on my particular setup can be found on this question: How to use vhosts alongside node-http-proxy?