title: Limiting Apache Spark CPU Usage
body: <p>i am using Apache Spark(standalone mode)  ALS recommendation algorithm with 60 GB of data , the problem is the CPU Spike to 100% when algorithms starts
  how can i set limitation CPU usage in spark ?
  for example just to use 50% of CPU.</p>
  
  <p>i have tried with less CPU cores , but it doesn't change anything regarding to CPU Usage.</p>
  
  <p>i am running spark in standalone mode in a server with following configuration : </p>
  
  <pre><code>#System information :
  OS Name:                   Microsoft Windows Server 2016 Standard
  OS Version:                10.0.14393 N/A Build 14393
  System Type:               x64-based PC
  Processor(s):              1 Processor(s) Installed.
  Cores:                     6
  Total Physical Memory:     262,030 MB
  Available Physical Memory: 178,164 MB
  Virtual Memory: Max Size:  300,942 MB
  Virtual Memory: Available: 215,377 MB
  
  #Spark 
  version 2.4.3
  
  #Java
  java version "10.0.2" 2018-07-17
  Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
  Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
  </code></pre>
  
  <p>and i have setup my spark session with following configs:</p>
  
  <pre><code>spark_session = SparkSession \
      .builder \
      .appName("ALSRecommendation") \
      .config("spark.driver.memory","60G")\
      .config('spark.cores.max', 5)\
      .config("spark.driver.cores",5)\
      .getOrCreate();
  </code></pre>