[nodejs] What's the limit of spawning child_processes?

2013-03-24 Thread simo
I have to serve a calculation via algorithm, I've been advised to use a child process per each opened socket, what I am about to do is something like that: var spawn = require('child_process').spawn;var child = spawn('node', ['algorithem.js']); I know how to send argument to the algorithm pr

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-24 Thread Alan Hoffmeister
I think that the maximum number of opened files is the only unix's limitation for the number of sockets, and this can be changed. -- Att, Alan Hoffmeister 2013/3/24 simo > I have to serve a calculation via algorithm, I've been advised to use a > child process per each opened socket, what I am

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-24 Thread Samir Sabri
So, is it a recommended approach to spawn a new process for each opened socket? On Sun, Mar 24, 2013 at 11:24 PM, Alan Hoffmeister < alanhoffmeis...@gmail.com> wrote: > I think that the maximum number of opened files is the only unix's > limitation for the number of sockets, and this can be chang

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Floby
no. Definitely not. Spawn a predefined number of workers (using the cluster api) and queue jobs in the master process then send them to the workers when they are ready to process. On Monday, 25 March 2013 06:49:32 UTC+1, simo wrote: > > So, is it a recommended approach to spawn a new process for

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread greelgorke
a better option is spawning a separate cluster of algorthm workers as service and using something like https://github.com/substack/dnode for communication. spawning a new process takes tens of miliseconds, which probably is to long for short living processes. Am Montag, 25. März 2013 06:49:32

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Samir Sabri
Thanks Floby, I appreciate your advice, do you know a good blog or source that talks about workers and jobs queuing? On Mon, Mar 25, 2013 at 10:52 AM, Floby wrote: > no. Definitely not. > Spawn a predefined number of workers (using the cluster api) and queue > jobs in the master process then sen

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Samir Sabri
You idea is great! but how can I manage load balance on the algorthm workers? if I have 100 algorthm workers for example? On Mon, Mar 25, 2013 at 12:35 PM, greelgorke wrote: > a better option is spawning a separate cluster of algorthm workers as > service and using something like https://github.

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread greelgorke
http://nodejs.org/api/cluster.html#cluster_how_it_works Am Montag, 25. März 2013 12:08:27 UTC+1 schrieb simo: > > You idea is great! but how can I manage load balance on the algorthm > workers? if I have 100 algorthm workers for example? > > On Mon, Mar 25, 2013 at 12:35 PM, greelgorke > > wrote

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Samir Sabri
Yes, I already found it, amazing tech On Mon, Mar 25, 2013 at 1:22 PM, greelgorke wrote: > http://nodejs.org/api/cluster.html#cluster_how_it_works > > Am Montag, 25. März 2013 12:08:27 UTC+1 schrieb simo: >> >> You idea is great! but how can I manage load balance on the algorthm >> workers? if I

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Matteo Collina
Hi Samir, I solved that problem for CPU intensive jobs. I ended up with my own control flow library, because no one has been gone in the route of "queuing" task with a work-in-progress limit in a sane way before: https://github.com/mcollina/kanban. There is async.queue, but it lacks some flexibili

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Matt
On Mon, Mar 25, 2013 at 11:14 AM, Matteo Collina wrote: > The number of worker processes you want to spawn in a given period of time > is strictly dependent to the number of concurrent process you might want to > run in your system. With node.js you can end up prettly quickly with load > > 1, and

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread greelgorke
there is also threads-a-gogo lib which can be used to spawn threads. i haven't use it yet (never really had to), but it is another option. Am Montag, 25. März 2013 12:26:12 UTC+1 schrieb simo: > > Yes, I already found it, amazing tech > > On Mon, Mar 25, 2013 at 1:22 PM, greelgorke > > wrote: >

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Samir Sabri
@Matteo Thanks, but as I am still at the beginning of this, I will need to find a way to simulate lots of users, and to find a way to profile performance, then I can decide what to do, if you can help me how to simulate virtual users and how to profile performance of my node app in real time, it wi

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Matt
On Mon, Mar 25, 2013 at 2:17 PM, Samir Sabri wrote: > @Mat you said ("load" should be divided by number of CPUs) isn't load > automatically divided when I node cluster? The load we were referring to is "load average": http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages --

Re: [nodejs] What's the limit of spawning child_processes?

2013-03-25 Thread Samir Sabri
Isn't there a cloud hosting provider who would auto scale my app? would it be possible to stay away from load avarage details so that my cloud hosting provider handle it? if so, who do you recommend? On 25 Mar 2013 20:34, "Matt" wrote: > > On Mon, Mar 25, 2013 at 2:17 PM, Samir Sabri wrote: > >>