Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-21960

Spark Streaming Dynamic Allocation should respect spark.executor.instances

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.2.0
    • 2.4.0
    • DStreams
    • None

    Description

      This check enforces that spark.executor.instances (aka --num-executors) is either unset or explicitly set to 0. https://github.com/apache/spark/blob/v2.2.0/streaming/src/main/scala/org/apache/spark/streaming/scheduler/ExecutorAllocationManager.scala#L207

      If spark.executor.instances is unset, the check is fine, and the property defaults to 2. Spark requests the cluster manager for 2 executors to start with, then adds/removes executors appropriately.

      However, if you explicitly set it to 0, the check also succeeds, but Spark never asks the cluster manager for any executors. When running on YARN, I repeatedly saw:

      17/08/22 19:35:21 WARN org.apache.spark.scheduler.cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
      17/08/22 19:35:36 WARN org.apache.spark.scheduler.cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
      17/08/22 19:35:51 WARN org.apache.spark.scheduler.cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
      

      I noticed that at least Google Dataproc and Ambari explicitly set spark.executor.instances to a positive number, meaning that to use dynamic allocation, you would have to edit spark-defaults.conf to remove the property. That's obnoxious.

      In addition, in Spark 2.3, spark-submit will refuse to accept "0" as a value for --num-executors or --conf spark.executor.instances: https://github.com/apache/spark/commit/0fd84b05dc9ac3de240791e2d4200d8bdffbb01a#diff-63a5d817d2d45ae24de577f6a1bd80f9

      It is much more reasonable for Streaming DRA to use spark.executor.instances, just like Core DRA. I'll open a pull request to remove the check if there are no objections.

      Attachments

        Activity

          People

            karth295 Karthik Palaniappan
            Karthik Palaniappan Karthik Palaniappan
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: