title: Number of threads to limit CPU usage
body: <p>My application is a "thread-per-request" web server with a thread pool of <code>M</code> threads. All processing of a single request runs in the same thread. </p>
  
  <p>Suppose I am running the application in a computer with <code>N</code> cores. I would like to configure <code>M</code> to limit the CPU usage: e.g. up to <code>50%</code> of all CPUs.</p>
  
  <p>If the processing were <em>entirely</em> CPU-bound then I would set <code>M</code> to <code>N/2</code>. However the processing does some IO.</p>
  
  <p>I can run the application with different <code>M</code> and use <code>top -H</code>, <code>ps -L</code>, <code>jstat</code>, etc. to monitor it. </p>
  
  <p>How would you suggest me estimate <code>M</code> ?</p>