Search code examples
javascriptnode.jsstronglooppm2

Are there more settings for Nodejs cluster?


Assumed you cluster your node app on a 4 CPU system, in 4 workers(childprocesses=new V8 instance) and each worker starts with about 10mb memory(default).

  1. Is there a way to start them with more? like --max-old-space-size=...

  2. And how can I pass in more V8-settings to workers?

( + how do strongloop and PM2 handle it? ;) )


Solution

  • You can use cluster.setupMaster() to set the arguments passed to worker processes. Specifically there is an undocumented execArgv setting that defaults to process.execArgv, but you should be able to pass any array of node/v8-specific flags there.

    Application arguments are passed via the args setting.