<?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>topic Re: ThreadPoolExecutor in Databricks in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8539#M4144</link>
    <description>&lt;P&gt;Hi @uzair mustafa​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2023 04:47:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-03-13T04:47:08Z</dc:date>
    <item>
      <title>ThreadPoolExecutor in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8537#M4142</link>
      <description>&lt;P&gt;I am using a threadpool executor and running notebooks in parallel. However, these parallel notebooks are not using executors at all and all the load is going towards the driver node resulting in running out of memory for the driver node and eventually crashing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parallel notebooks are all same and involve creating huge pandas dataframes, spark dataframes, and appending them to delta tables. What am I missing? How do I redirect load to executor nodes?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 20:56:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8537#M4142</guid>
      <dc:creator>uzairm</dc:creator>
      <dc:date>2023-02-28T20:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: ThreadPoolExecutor in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8538#M4143</link>
      <description>&lt;P&gt;@uzair mustafa​&amp;nbsp;: Using a threadpool executor to parallelize the execution of notebooks may not be enough to distribute the load across your cluster. When you use threadpool executor, all threads are running on the same node, might run out of memory as well -&amp;gt; this is the desired result.&lt;/P&gt;&lt;P&gt;To tackle your problem, can you try running each notebook as a separate process and create a Spark Context within that process. Please try using "subprocess" module in Python to spawn a new process for each notebook. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 08:00:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8538#M4143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-07T08:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: ThreadPoolExecutor in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8539#M4144</link>
      <description>&lt;P&gt;Hi @uzair mustafa​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 04:47:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/8539#M4144</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-13T04:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: ThreadPoolExecutor in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/165611#M55458</link>
      <description>&lt;P&gt;This is a useful distinction between Python-level threading and Spark’s distributed execution. If the notebooks are creating large Pandas DataFrames on the driver, increasing the thread count could easily make the memory problem worse. Using separate processes and creating the Spark context there seems like a much more appropriate approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2026 11:01:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/165611#M55458</guid>
      <dc:creator>stephen4</dc:creator>
      <dc:date>2026-08-13T11:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: ThreadPoolExecutor in Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/165613#M55460</link>
      <description>&lt;P&gt;Good point on the threading vs. process distinction. To add a bit more&lt;BR /&gt;context:&lt;/P&gt;&lt;P&gt;Root cause: ThreadPoolExecutor only parallelizes within the driver's&lt;BR /&gt;single Python process. All threads share the same driver memory, so&lt;BR /&gt;pandas DataFrame creation across threads competes for the same heap —&lt;BR /&gt;Spark executors never get involved because no distributed Spark job is&lt;BR /&gt;actually being triggered.&lt;/P&gt;&lt;P&gt;Quick fixes:&lt;BR /&gt;- Replace pandas with Spark DataFrames where possible — they're lazily&lt;BR /&gt;evaluated and distributed to executors instead of living on the driver.&lt;BR /&gt;- If you must run notebooks in parallel, use subprocess/multiprocessing&lt;BR /&gt;instead of threading so each run gets its own process and SparkSession,&lt;BR /&gt;rather than sharing driver memory.&lt;BR /&gt;- Cap concurrency (e.g., max_workers=2-4) as a short-term mitigation&lt;BR /&gt;while you migrate the heavy logic to Spark.&lt;/P&gt;&lt;P&gt;Long term, it's usually better to express the "N parallel notebooks" as&lt;BR /&gt;one Spark job over a partitioned dataset, letting Spark's scheduler&lt;BR /&gt;distribute compute across executors natively instead of retrofitting&lt;BR /&gt;parallelism at the notebook level.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2026 11:06:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/threadpoolexecutor-in-databricks/m-p/165613#M55460</guid>
      <dc:creator>srimonishan</dc:creator>
      <dc:date>2026-08-13T11:06:03Z</dc:date>
    </item>
  </channel>
</rss>

