<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Spark dynamic-allocation dont work in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140231#M35412</link>
    <description>&lt;P&gt;With an input value of 100000 the SparkPi needed about 3 minutes. I checked the number of cores often, but nothing changed.&lt;/P&gt;&lt;P&gt;I never used the Spark thriftserver before. Can you tell me how to a demo job?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2016 14:34:01 GMT</pubDate>
    <dc:creator>retricia1</dc:creator>
    <dc:date>2016-07-21T14:34:01Z</dc:date>
    <item>
      <title>Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140227#M35408</link>
      <description>&lt;P&gt;I want to use the &lt;STRONG&gt;dynamic-allocation&lt;/STRONG&gt; feature from spark for my submitted applications, but the applications do not scale.&lt;/P&gt;&lt;P&gt;My cluster consists of &lt;STRONG&gt;3 nodes&lt;/STRONG&gt; and each has:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;4 cores&lt;/LI&gt;&lt;LI&gt;8GB RAM&lt;/LI&gt;&lt;LI&gt;spark: 1.6&lt;/LI&gt;&lt;LI&gt;YARN + MapReduce2: 2.7&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I use hdp 2.4 and set up all needed dynamic-allocation properties as follows (they were preconfigured in hdp but I verify them with the &lt;A href="https://spark.apache.org/docs/latest/job-scheduling.html#configuration-and-setup"&gt;docs&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;spark.dynamicAllocation.enabled=true&lt;/LI&gt;&lt;LI&gt;spark.dynamicAllocation.initialExecutors=5&lt;/LI&gt;&lt;LI&gt;spark.dynamicAllocation.maxExecutors=10&lt;/LI&gt;&lt;LI&gt;spark.dynamicAllocation.minExecutors=1&lt;/LI&gt;&lt;LI&gt;spark.shuffle.service.enabled=true&lt;/LI&gt;&lt;LI&gt;yarn.nodemanager.aux-services=mapreduce_shuffle,spark_shuffle&lt;/LI&gt;&lt;LI&gt;yarn.nodemanager.aux-services.spark_shuffle.class=org.apache.spark.network.yarn.YarnShuffleService&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I use the yarn ResourceManager-UI to lookup the used cores.&lt;/P&gt;&lt;P&gt;When I submit the following PI-example &lt;STRONG&gt;only 3 container with each 1 core are used&lt;/STRONG&gt;. There where enough resources to allocate, but no more resources were used.&lt;/P&gt;&lt;PRE&gt;./bin/spark-submit --class org.apache.spark.examples.SparkPi \
--master yarn-cluster \
--deploy-mode cluster \
--driver-memory 512m \
--executor-memory 512m \
lib/spark-examples*.jar 10000
&lt;/PRE&gt;&lt;P&gt;When I test to submit the PI-example with a defined number of executors, it a lot more resources could be allocated. In this example it static allocate 8 container with each 1 core. (1 driver + 7 executor)&lt;/P&gt;&lt;PRE&gt;./bin/spark-submit --class org.apache.spark.examples.SparkPi \
--master yarn-cluster \
--num-executors 7 \
--driver-memory 512m \
--executor-memory 512m \
lib/spark-examples*.jar 100000&lt;/PRE&gt;&lt;P&gt;What did I wrong, that spark not automatically allocate the maximum of available resources?&lt;/P&gt;&lt;P&gt;Thank you for you help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 11:35:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140227#M35408</guid>
      <dc:creator>retricia1</dc:creator>
      <dc:date>2016-07-21T11:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140228#M35409</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/200/awatson.html" nodeid="200"&gt;@Andrew Watson&lt;/A&gt; have you seen this?  &lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 11:44:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140228#M35409</guid>
      <dc:creator>sunile_manjee</dc:creator>
      <dc:date>2016-07-21T11:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140229#M35410</link>
      <description>&lt;P&gt;Using the first command: only 3 cores are used&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5932-3-cores.png" style="width: 1898px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21779iDB59690F59674016/image-size/medium?v=v2&amp;amp;px=400" role="button" title="5932-3-cores.png" alt="5932-3-cores.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The second command: 8 cores are used&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5933-8-cores.png" style="width: 1895px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21780i011A4D3E6B823E87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="5933-8-cores.png" alt="5933-8-cores.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 08:21:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140229#M35410</guid>
      <dc:creator>retricia1</dc:creator>
      <dc:date>2019-08-19T08:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140230#M35411</link>
      <description>&lt;P&gt;I think SparkPi cannot effective validate the functionality of dynamic allocation, basically because it runs so fast that give little time for dynamic allocation to bring up more executors. For dynamic allocation, it needs to detect current loads (num of tasks) and calculate the expected number of executors, and then issue requests to AM/RM/NM through RPC, usually it took several seconds to handle this pipeline. But I guess the whole SparkPi application will only run several seconds, so it is too fast for dynamic allocation to fully request the expected resources. If you want to verify the functionality of dynamic allocation, Spark thriftserver is good candidate.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 14:08:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140230#M35411</guid>
      <dc:creator>sshao</dc:creator>
      <dc:date>2016-07-21T14:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140231#M35412</link>
      <description>&lt;P&gt;With an input value of 100000 the SparkPi needed about 3 minutes. I checked the number of cores often, but nothing changed.&lt;/P&gt;&lt;P&gt;I never used the Spark thriftserver before. Can you tell me how to a demo job?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 14:34:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140231#M35412</guid>
      <dc:creator>retricia1</dc:creator>
      <dc:date>2016-07-21T14:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140232#M35413</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/12001/retricia1.html" nodeid="12001"&gt;@Rene Rene&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Documentation about Dynamic Execution says the following (&lt;STRONG&gt;bold&lt;/STRONG&gt; mine):&lt;/P&gt;&lt;P&gt;There are &lt;STRONG&gt;two&lt;/STRONG&gt; requirements for using this feature. &lt;STRONG&gt;First&lt;/STRONG&gt;, your application must set &lt;CODE&gt;spark.dynamicAllocation.enabled&lt;/CODE&gt; to &lt;CODE&gt;true&lt;/CODE&gt;. &lt;STRONG&gt;Second&lt;/STRONG&gt;, you must set up an &lt;EM&gt;external shuffle service&lt;/EM&gt; on each worker node in the same cluster and set &lt;CODE&gt;spark.shuffle.service.enabled&lt;/CODE&gt; to true in your application. The purpose of the external shuffle service is to allow executors to be removed without deleting shuffle files written by them (more detail described &lt;A href="https://spark.apache.org/docs/latest/job-scheduling.html#graceful-decommission-of-executors"&gt;below&lt;/A&gt;). The way to set up this service varies across cluster managers:&lt;/P&gt;&lt;P&gt;In standalone mode, simply start your workers with &lt;CODE&gt;spark.shuffle.service.enabled&lt;/CODE&gt; set to &lt;CODE&gt;true&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;In Mesos coarse-grained mode, run &lt;CODE&gt;$SPARK_HOME/sbin/start-mesos-shuffle-service.sh&lt;/CODE&gt; on all slave nodes with&lt;CODE&gt;spark.shuffle.service.enabled&lt;/CODE&gt; set to &lt;CODE&gt;true&lt;/CODE&gt;. For instance, you may do so through Marathon.&lt;/P&gt;&lt;P&gt;In YARN mode, start the shuffle service on each &lt;CODE&gt;NodeManager&lt;/CODE&gt; as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Build Spark with the &lt;A href="https://spark.apache.org/docs/latest/building-spark.html"&gt;YARN profile&lt;/A&gt;. Skip this step if you are using a pre-packaged distribution.&lt;/LI&gt;&lt;LI&gt;Locate the &lt;CODE&gt;spark-&amp;lt;version&amp;gt;-yarn-shuffle.jar&lt;/CODE&gt;. This should be under &lt;CODE&gt;$SPARK_HOME/network/yarn/target/scala-&amp;lt;version&amp;gt;&lt;/CODE&gt; if you are building Spark yourself, and under &lt;CODE&gt;lib&lt;/CODE&gt; if you are using a distribution.&lt;/LI&gt;&lt;LI&gt;Add this jar to the classpath of all &lt;CODE&gt;NodeManager&lt;/CODE&gt;s in your cluster.&lt;/LI&gt;&lt;LI&gt;In the &lt;CODE&gt;yarn-site.xml&lt;/CODE&gt; on each node, add &lt;CODE&gt;spark_shuffle&lt;/CODE&gt; to &lt;CODE&gt;yarn.nodemanager.aux-services&lt;/CODE&gt;, then set &lt;CODE&gt;yarn.nodemanager.aux-services.spark_shuffle.class&lt;/CODE&gt; to &lt;CODE&gt;org.apache.spark.network.yarn.YarnShuffleService&lt;/CODE&gt;.&lt;/LI&gt;&lt;LI&gt;Restart all &lt;CODE&gt;NodeManager&lt;/CODE&gt;s in your cluster.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;All other relevant configurations are optional and under the &lt;CODE&gt;spark.dynamicAllocation.*&lt;/CODE&gt; and &lt;CODE&gt;spark.shuffle.service.*&lt;/CODE&gt; namespaces. For more detail, see the &lt;A href="https://spark.apache.org/docs/latest/configuration.html#dynamic-allocation"&gt;configurations page&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Reference Link: &lt;/P&gt;&lt;P&gt;&lt;A href="https://spark.apache.org/docs/latest/job-scheduling.html#dynamic-resource-allocation"&gt;https://spark.apache.org/docs/latest/job-scheduling.html#dynamic-resource-allocation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 23:55:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140232#M35413</guid>
      <dc:creator>phargis</dc:creator>
      <dc:date>2016-07-21T23:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140233#M35414</link>
      <description>&lt;P&gt;1. If the initialExecutors = 5 as you set, the initial number of executors should be 5 as monitored.&lt;/P&gt;&lt;P&gt;2. Another concern is that if you want to bring up the executor number to maximum, you need to submit jobs continuously to increase the load of scheduler. In your case SparkPi application only has one job, so the load of scheduler will be decrease once after the job is submitted and Dynamic Allocation will schedule the new expected resource number.&lt;/P&gt;&lt;P&gt;3. If you're using latest version of HDP, thriftserver is already installed with dynamic allocation enabled be default. You could use beeline to submit SQL queries.&lt;/P&gt;&lt;P&gt;4. The logics of code is correct, I think what you need to do is to try different scenarios to trigger that logic.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 07:58:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140233#M35414</guid>
      <dc:creator>sshao</dc:creator>
      <dc:date>2016-07-22T07:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140234#M35415</link>
      <description>&lt;P&gt;I hope it worked after starting the shuffle service, but fyi here are three related HDP 2.4.0 documentation pages for clusters and jobs. &lt;/P&gt;&lt;P&gt;&lt;A href="http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_spark-guide/content/config-dra-manual.html" target="_blank"&gt;http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_spark-guide/content/config-dra-manual.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_spark-guide/content/ch_config-dea.html" target="_blank"&gt;http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_spark-guide/content/ch_config-dea.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_spark-guide/content/config-dra-job.html" target="_blank"&gt;http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.0/bk_spark-guide/content/config-dra-job.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(If you're on 2.4.2, there's an equivalent set of pages under .../HDP-2.4.2/...)&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jul 2016 02:34:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140234#M35415</guid>
      <dc:creator>lgeorge</dc:creator>
      <dc:date>2016-07-23T02:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140235#M35416</link>
      <description>&lt;P&gt;I think it was my problem, sorry.&lt;/P&gt;&lt;P&gt;I only checked the configs from the spark-thrift-sparkconf. After adding the config to spark-default it works. &lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 17:23:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140235#M35416</guid>
      <dc:creator>retricia1</dc:creator>
      <dc:date>2016-07-25T17:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Spark dynamic-allocation dont work</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140236#M35417</link>
      <description>&lt;P&gt;
	We were into the same scenario where Zeppelin was always launching the 3 Containers in YARN even after having the Dynamic allocation parameters enabled from Spark but Zeppelin is not able to pick these parameters, &lt;/P&gt;&lt;P&gt;
	To get the Zeppelin to launch more than 3 containers (the default it is launching) we need to configure in the Zeppelin Spark interpreter&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;EM&gt;spark.dynamicAllocation.enabled=true &lt;/EM&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;
	&lt;STRONG&gt;&lt;EM&gt;spark.shuffle.service.enabled=true&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;
	&lt;STRONG&gt;&lt;EM&gt;spark.dynamicAllocation.initialExecutors=0 &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;
	&lt;EM&gt;&lt;STRONG&gt;spark.dynamicAllocation.minExecutors=2  --&amp;gt; &lt;/STRONG&gt;Start this value with the lower number, if not it will launch number of the minimum containers specified and will only use the required containers (memory and VCores) and rest of the memory and VCores will be marked as reserved memory and causes memory issues&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;
	&lt;STRONG&gt;&lt;EM&gt;spark.dynamicAllocation.maxExecutors=10&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;
	And it is always good to start with less executor memory  (e.g 10/15g) and more executors (20/30)&lt;/P&gt;&lt;P&gt;Our scenario we have observed that giving the executor memory (50/100g) and executors as (5/10) the query took 3min 48secs (228sec) --&amp;gt; which is obvious as the parallelism is very less and reducing the executor memory (10/15g) and increasing the executors (25/30) the same query took on 54secs. &lt;/P&gt;&lt;P&gt;Please note the number of executors and executor memory are usecase dependent and we have done few trails before getting the optimal performance for our scenario.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 15:19:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Spark-dynamic-allocation-dont-work/m-p/140236#M35417</guid>
      <dc:creator>dheer_vijji_rag</dc:creator>
      <dc:date>2017-07-28T15:19:19Z</dc:date>
    </item>
  </channel>
</rss>

