Use several processes with redis as datastore
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Multiple processes with redis

By default configuration, uses the memory (MemoryStore) to hold open connections. Hence it is not possible to run several processes, because the processes won't know nothing about the open connections of the other processes. But it's quite easy to use redis as store, which allows to share the open connections between several processes, which run on different ports.

You can use some kind of load balancer to distribute workload or use nodes http proxy module node-http-proxy to access the processes.


Install node.js:

npm install
npm install
npm install redis

Install and run redis:

Run two server processes:

node server.js // default port is 8090
node server.js 8091
node server.js 8092

Start as much clients you like:

node client.js // default port is 8090
node client.js 8091
node client.js 8092