Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a parameter for number of workers in cluster mode #18

Closed
gusostow opened this issue Oct 27, 2022 · 3 comments
Closed

Create a parameter for number of workers in cluster mode #18

gusostow opened this issue Oct 27, 2022 · 3 comments

Comments

@gusostow
Copy link

No description provided.

@zbanga
Copy link

zbanga commented Jun 9, 2023

if (cluster.isMaster) {
  for (let i = 0; i < numCPUs; i++) {
    cluster.fork()
  }
  
  The number of workers in your cluster is bound by the amount of CPU your server/computer has. It's probably not wise to go beyond the CPU limit as I imagine its probably one thread per CPU. 

@gusostow
Copy link
Author

gusostow commented Jun 9, 2023

My desire was to use fewer than my total CPUs

@zbanga
Copy link

zbanga commented Jun 10, 2023

You can edit the file to use less than the total amount if CPUs and pass it in as a parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants