rvagg / node-worker-farm

Distribute processing tasks to child processes with an über-simple API and baked-in durability & custom concurrency options.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Children working in series

zzzbatmand opened this issue · comments

It seem like the children is working in series and they wait for the previous one to finish.
When i try to run the pi program it returns

Doing it the slow (single-process) way...
5348
5348
5348
5348
π ≈ 3.1413785799999996  (0.00021407358979352864 away from actual!)
took 9561 milliseconds
Doing it the fast (multi-process) way...
5355
5355
5355
5355
π ≈ 3.1417808   (0.00018814641020670209 away from actual!)
took 9597 milliseconds

It's supposed to run the multi-process way faster, but it doesn't, it seems that it's waiting for the previous child to finish, before starting the next one. Why is that?

Found the problem, it was because it used the amount of cpu's to limit the amount of workers at the same time, and i am running in a virtual linux server with only 1 cpu.

I just changed
maxConcurrentWorkers: 4
and set CHILDREN = 4.