Re: [nodejs] Cluster question

2015-04-17 Thread Ω Alisson
Digging this topic again, I'm unable to make the worker process log anything on shutdown...tried with internalMessage, message(worker.send()), nothing happens. On Wed, Dec 17, 2014 at 3:16 AM, Ryan Graham wrote: > Can you share how you accomplished this? (in code, if possible.. JS is way > bette

Re: [nodejs] Cluster question

2014-12-16 Thread Ryan Graham
Can you share how you accomplished this? (in code, if possible.. JS is way better than English with the diversity of backgrounds and native languages seen on this list) I'm not aware of a JS level API in node core that provides what you described, so like Sam, I assumed you meant a busy loop which

Re: [nodejs] Cluster question

2014-12-16 Thread Ω Alisson
Well I did it and the CPU is running at 0.2% On Tue, Dec 16, 2014 at 11:22 PM, Sam Roberts wrote: > > On Wed, Dec 10, 2014 at 8:15 PM, Ω Alisson wrote: > > Interesting Sam, but what if I set a flag that is checked every > > process.nextTick > > You will eat 100% CPU, rather than waiting on event

Re: [nodejs] Cluster question

2014-12-16 Thread Sam Roberts
On Wed, Dec 10, 2014 at 8:15 PM, Ω Alisson wrote: > Interesting Sam, but what if I set a flag that is checked every > process.nextTick You will eat 100% CPU, rather than waiting on event from the master saying that its time to go away, and being able to do the cleanup you want: > suspends redis

Re: [nodejs] Cluster question

2014-12-10 Thread Ω Alisson
Interesting Sam, but what if I set a flag that is checked every process.nextTick and suspends redis updates, so what's left is finishing iterating over in-memory items? On Wed, Dec 10, 2014 at 8:47 PM, Sam Roberts wrote: > >> On Monday, December 8, 2014 at 3:47 PM, Ω Alisson wrote: > >> > >> I'm

Re: [nodejs] Cluster question

2014-12-10 Thread Sam Roberts
>> On Monday, December 8, 2014 at 3:47 PM, Ω Alisson wrote: >> >> I'm running a Node app that fetches Redis data into another database. It´s >> using the cluster module, everything works fine but I need to ensure that >> workers will finish properly their jobs(they use BRPOP then allocate into a >>

Re: [nodejs] Cluster question

2014-12-09 Thread John Fitzgerald
Yes, that works pretty well actually, I've used it a lot to synchronize a small in-memory cache to each process and distribute jobs to workers. 2014-12-09 7:33 GMT-08:00 Ω Alisson : > if I do something like this on a worker process, wouldn't be effective? > > process.on("message", function(m) {

Re: [nodejs] Cluster question

2014-12-09 Thread Ω Alisson
if I do something like this on a worker process, wouldn't be effective? process.on("message", function(m) { if(m.cmd === "disconnect") { // cleanup logic } }) On Tue, Dec 9, 2014 at 5:20 AM, Issac Roth wrote: > There are many ways to do this but we created strong-mq >

Re: [nodejs] Cluster question

2014-12-09 Thread Issac Roth
There are many ways to do this but we created strong-mq (https://www.npmjs.org/package/strong-mq) with this kind of use case in mind. What’s nice is you can use a common message-passing pattern between workers that runs natively over node-cluster without installing anything else, and if you end

[nodejs] Cluster question

2014-12-08 Thread Ω Alisson
I'm running a Node app that fetches Redis data into another database. It´s using the cluster module, everything works fine but I need to ensure that workers will finish properly their jobs(they use BRPOP then allocate into a object then insert in batches cleaning the objects), how do I do this? --