title: Node.js Cluster: Managing Workers
body: <p>we're diving deeper in Node.js architecture, to achieve fully understanding, how to scale our application. 
  Clear solution is cluster usage <a href="https://nodejs.org/api/cluster.html" rel="nofollow noreferrer">https://nodejs.org/api/cluster.html</a>. Everything seems to be fine, apart of workers management description:</p>
  
  <blockquote>
    <p>Node.js does not automatically manage the number of workers for you, however. It is your responsibility to manage the worker pool for your application's needs.</p>
  </blockquote>
  
  <p>I was searching, how to really manage the workers, but most solutions, says: </p>
  
  <blockquote>
    <p>Start so many workers as you've got cores. </p>
  </blockquote>
  
  <p>But I would like to dynamically scale up or down my workers count, depending on current load on server. So if there is load on server and queue is getting longer,  I would like to start next worker. In another way, when there isn't so much load, I would like to shut down workers (and leave f.e. minimum 2 of them).</p>
  
  <p>The ideal place, will be for me Master Process queue, and event when new Request is coming to Master Process. On this place we can decide if we need next worker.</p>
  
  <p>Do you have any solution or experience with managing workers from Master Thread in Cluster? Starting and killing them dynamically?</p>
  
  <p>Regards,</p>
  
  <p>Radek</p>