LearnBoost / cluster

Node.JS multi-core server manager with plugins support.
http://learnboost.github.com/cluster
MIT License
2.29k stars 159 forks source link

passing v8 options to workers #139

Open gitfy opened 13 years ago

gitfy commented 13 years ago

Hi, How do i pass the v8 options to the cluster workers. I need to pass --max-old-space-size=1900 to all my workers, but somehow looks like the option is not passed and the node process dies when it eventually reaches the max mem of 1gb.

Thanks.

tj commented 13 years ago

hmm they should be passing fine:

  this.proc = spawn(
      node
    , this.master.cmd
    , { customFds: customFds, env: env });

where for example this.master.cmd in my case was [ '/Users/tj/projects/cluster/examples/basic', '--crankshaft' ]

passing along the args just fine

gitfy commented 13 years ago

The issues is : node options or v8 options should be passed like

node [options] script.js [app-options]

The spawn parameter this.master.cmd should have the node/v8-options as the first entry rather than second in the list. Only then it will work.

Here is an example of the process list from my machine :

501 10261 10257 4006 0 33 0 4741568 1391092 - R+ f967540 ttys000 27:49.01 node --max-old-space-size=1900 cluster.js --port=7100 --workers=4 --noref 501 10263 10261 4006 0 33 0 3413968 113820 - S+ f3dd7e0 ttys000 13:14.86 node cluster.js --port=7100 --workers=4 --noref 501 10264 10261 4006 0 33 0 3821540 563684 - R+ ee0f540 ttys000 3:56.97 node cluster.js --port=7100 --workers=4 --noref 501 10265 10261 4006 0 33 0 3418996 108628 - S+ 13ee4000 ttys000 10:12.39 node cluster.js --port=7100 --workers=4 --noref 501 10266 10261 4006 0 33 0 3396816 103820 - S+ f3dd540 ttys000 13:20.19 node cluster.js --port=7100 --workers=4 --noref

as you can see the cluster has the option, but the worker don't have at all.

tj commented 13 years ago

ah ok I see now

tj commented 13 years ago

doesn't seem like node exposes those args, not that I can see at least

gitfy commented 13 years ago

Node FAQ mentions about this and also i checked the behavior with a single node process and it works.

https://github.com/joyent/node/wiki/FAQ