Seem that problem is the conflict between cluster module and socket.io:
https://github.com/LearnBoost/socket.io/issues/798#issuecomment-7965366

Anybody figure out the way to resolve it?

Thanks.

On Thu, Aug 23, 2012 at 4:01 PM, hd nguyen <nguyenhd2...@gmail.com> wrote:

> Hi all,
>
> I'm using cluster module to utilize multi-core machine (
> http://nodejs.org/api/cluster.html#cluster_class_worker).
>
> My program will be hosted in different machine, so in each worker I use
> redis pubsub to broadcast to other servers.
>
> The code should be like following snippet:
>
> if(cluster.isMaster) {
>     // create workers
>     for (var i = 0; i < numCPUs; i++) {
>         global.cluster.fork();
>     }
>
>     global.cluster.on('exit', function(worker, code, signal) {
>         console.log('worker ' + worker.process.pid + ' died');
>     });
> }
> else {
>     // do worker's task
>    pub = redis.createClient(port, host);
>    sub = redis.createClient(port, host);
>
>    ..... use pub/sub to broadcast to other servers when needed
> }
>
> What I concern here is that if I do not use cluster, just use single
> thread, everything is ok, pubsub works properly between servers.
>
> But when applying cluster, pubsub does not work?? Data cannot be sent to
> other servers, but in the same machine everything is still ok although
> different users belong to different workers.
>
> I'm not sure about role of MASTER process and WORKER process here,
> anything wrong in my code, I should listen message event from pubsub in
> MASTER process, then send to WORKER?
>
> Welcome your comments all.
> Thanks in advance.
>
> --
> Nguyen Hai Duy
> Mobile : 0914 72 1900
> Yahoo: nguyenhd_lucky
>



-- 
Nguyen Hai Duy
Mobile : 0914 72 1900
Yahoo: nguyenhd_lucky

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to