title: How to restrict processing to specified number of cores in spark standalone
body: <p>We have tried using various combinations of settings - but mpstat is showing that all or most cpu's are always being used (on a single 8 core system)</p>
  
  <p>Following have been tried:</p>
  
  <p>set master to: </p>
  
  <pre><code>local[2]
  </code></pre>
  
  <p>send in</p>
  
  <pre><code>conf.set("spark.cores.max","2")
  </code></pre>
  
  <p>in the spark configuration</p>
  
  <p>Also using </p>
  
  <pre><code>--total-executor-cores 2
  </code></pre>
  
  <p>and</p>
  
  <pre><code>--executor-cores 2
  </code></pre>
  
  <p>In all cases </p>
  
  <pre><code>mpstat -A
  </code></pre>
  
  <p>shows that all of the CPU's are being used - and not just by the master.</p>
  
  <p>So I am at a loss presently.  We do need to limit the usage to a specified number of cpu's.</p>