<?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 🚀 Spark Caching vs Databricks Disk Caching in Community Articles</title>
    <link>https://community.databricks.com/t5/community-articles/spark-caching-vs-databricks-disk-caching/m-p/130056#M624</link>
    <description>&lt;P&gt;As promised &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146924"&gt;@BS_THE_ANALYST&lt;/a&gt;&amp;nbsp;, in this new video and summarized in post, I try to explain what&amp;nbsp;&lt;STRONG&gt;Spark Caching&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;Databricks Disk Caching&lt;/STRONG&gt; are and how Caching strategy can be leveraged by making these cool features work together:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Spark Caching vs Databricks Disk Caching" href="https://youtu.be/_vWnH4kmF60" target="_blank" rel="noopener"&gt;Spark Caching vs Databricks Disk Caching&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://youtu.be/_vWnH4kmF60" target="_blank" rel="noopener"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Coffee77_1-1756394420204.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19449i2F4CC298412EF9F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Coffee77_1-1756394420204.png" alt="Coffee77_1-1756394420204.png" /&gt;&lt;/span&gt;&lt;/A&gt;&lt;/P&gt;&lt;H2&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Spark Caching&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;(Memory/Disk via &lt;/STRONG&gt;&lt;STRONG&gt;cache() or persist())&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;Scope:&lt;/STRONG&gt; Spark application / job level&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;How it works:&amp;nbsp;&lt;/STRONG&gt;When you call .cache() or .persist() on a DataFrame/RDD, Spark materializes that dataset after the first action and keeps it in &lt;STRONG&gt;executor memory&lt;/STRONG&gt; (RAM). If memory is insufficient and .persist()&amp;nbsp;used it can optionally spill to disk depending on the storage level (MEMORY_ONLY, MEMORY_AND_DISK, etc.).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Where it lives:&lt;/STRONG&gt; Inside the Spark executor JVM heap, and optionally on local disk.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Persistence:&lt;/STRONG&gt;&amp;nbsp;Data disappears when the Spark application ends, or if it is evicted due to memory pressure.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Best for:&amp;nbsp;&lt;/STRONG&gt;Reusing intermediate results across multiple actions in the same job&lt;STRONG&gt;&lt;STRONG&gt;,&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;Iterative algorithms (ML, graph processing, etc.)&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Databricks Disk Caching &lt;FONT size="3"&gt;(Before known as Delta Cache)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;Scope:&lt;/STRONG&gt; Cluster level&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;How it works:&amp;nbsp;&lt;/STRONG&gt;This is a &lt;STRONG&gt;transparent IO-level cache&lt;/STRONG&gt; built into Databricks Runtime that stores &lt;STRONG&gt;data from cloud object storage (S3, ADLS, GCS)&lt;/STRONG&gt; onto the &lt;STRONG&gt;local NVMe SSDs&lt;/STRONG&gt; of the cluster nodes. It’s at the &lt;STRONG&gt;file block&lt;/STRONG&gt; level, not tied to a Spark job.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Databricks &lt;STRONG&gt;disk caching&lt;/STRONG&gt; can only be enabled on &lt;STRONG&gt;clusters that have local SSD storage&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":warning:"&gt;⚠️&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Where it lives:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Outside of the JVM, o&lt;/SPAN&gt;&lt;SPAN&gt;n local SSDs of the Databricks cluster and m&lt;/SPAN&gt;&lt;SPAN&gt;anaged automatically by Databricks Runtime.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Persistence:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Survives across Spark jobs running on the same cluster, c&lt;/SPAN&gt;&lt;SPAN&gt;leared when the cluster is terminated or when local SSD storage is needed for something else.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Best for:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Repeated reads of &lt;/SPAN&gt;&lt;STRONG&gt;the same files&lt;/STRONG&gt;&lt;SPAN&gt; from cloud storage across different jobs or notebooks, i&lt;/SPAN&gt;mproving read performance from Delta tables and Parquet files&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Trigger:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;No code change, a&lt;/SPAN&gt;&lt;SPAN&gt;utomatic on &lt;/SPAN&gt;&lt;STRONG&gt;DBR &amp;gt;= 10.4,&lt;/STRONG&gt;&amp;nbsp;enabled via &lt;STRONG&gt;spark.databricks.io.cache.enabled true&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Why Together = Best Performance&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Disk caching&lt;/STRONG&gt; = reduces &lt;STRONG&gt;cloud I/O latency&lt;/STRONG&gt; (cluster-wide).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Spark caching&lt;/STRONG&gt; = reduces &lt;STRONG&gt;recomputation overhead&lt;/STRONG&gt; (job-specific).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Coffee77_0-1756394294274.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19448i12783E77C313E68B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Coffee77_0-1756394294274.jpeg" alt="Coffee77_0-1756394294274.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using both ensures:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Faster &lt;STRONG&gt;initial reads&lt;/STRONG&gt;&amp;nbsp;thanks to SSD cache.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Faster &lt;STRONG&gt;subsequent transformations&lt;/STRONG&gt; and iterative operations thanks to Spark memory and/or cache.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Aug 2025 15:42:49 GMT</pubDate>
    <dc:creator>Coffee77</dc:creator>
    <dc:date>2025-08-28T15:42:49Z</dc:date>
    <item>
      <title>🚀 Spark Caching vs Databricks Disk Caching</title>
      <link>https://community.databricks.com/t5/community-articles/spark-caching-vs-databricks-disk-caching/m-p/130056#M624</link>
      <description>&lt;P&gt;As promised &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146924"&gt;@BS_THE_ANALYST&lt;/a&gt;&amp;nbsp;, in this new video and summarized in post, I try to explain what&amp;nbsp;&lt;STRONG&gt;Spark Caching&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;Databricks Disk Caching&lt;/STRONG&gt; are and how Caching strategy can be leveraged by making these cool features work together:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Spark Caching vs Databricks Disk Caching" href="https://youtu.be/_vWnH4kmF60" target="_blank" rel="noopener"&gt;Spark Caching vs Databricks Disk Caching&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://youtu.be/_vWnH4kmF60" target="_blank" rel="noopener"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Coffee77_1-1756394420204.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19449i2F4CC298412EF9F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Coffee77_1-1756394420204.png" alt="Coffee77_1-1756394420204.png" /&gt;&lt;/span&gt;&lt;/A&gt;&lt;/P&gt;&lt;H2&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Spark Caching&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;(Memory/Disk via &lt;/STRONG&gt;&lt;STRONG&gt;cache() or persist())&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;Scope:&lt;/STRONG&gt; Spark application / job level&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;How it works:&amp;nbsp;&lt;/STRONG&gt;When you call .cache() or .persist() on a DataFrame/RDD, Spark materializes that dataset after the first action and keeps it in &lt;STRONG&gt;executor memory&lt;/STRONG&gt; (RAM). If memory is insufficient and .persist()&amp;nbsp;used it can optionally spill to disk depending on the storage level (MEMORY_ONLY, MEMORY_AND_DISK, etc.).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Where it lives:&lt;/STRONG&gt; Inside the Spark executor JVM heap, and optionally on local disk.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Persistence:&lt;/STRONG&gt;&amp;nbsp;Data disappears when the Spark application ends, or if it is evicted due to memory pressure.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Best for:&amp;nbsp;&lt;/STRONG&gt;Reusing intermediate results across multiple actions in the same job&lt;STRONG&gt;&lt;STRONG&gt;,&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN&gt;Iterative algorithms (ML, graph processing, etc.)&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H2&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Databricks Disk Caching &lt;FONT size="3"&gt;(Before known as Delta Cache)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;Scope:&lt;/STRONG&gt; Cluster level&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;How it works:&amp;nbsp;&lt;/STRONG&gt;This is a &lt;STRONG&gt;transparent IO-level cache&lt;/STRONG&gt; built into Databricks Runtime that stores &lt;STRONG&gt;data from cloud object storage (S3, ADLS, GCS)&lt;/STRONG&gt; onto the &lt;STRONG&gt;local NVMe SSDs&lt;/STRONG&gt; of the cluster nodes. It’s at the &lt;STRONG&gt;file block&lt;/STRONG&gt; level, not tied to a Spark job.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Databricks &lt;STRONG&gt;disk caching&lt;/STRONG&gt; can only be enabled on &lt;STRONG&gt;clusters that have local SSD storage&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":warning:"&gt;⚠️&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Where it lives:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Outside of the JVM, o&lt;/SPAN&gt;&lt;SPAN&gt;n local SSDs of the Databricks cluster and m&lt;/SPAN&gt;&lt;SPAN&gt;anaged automatically by Databricks Runtime.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Persistence:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Survives across Spark jobs running on the same cluster, c&lt;/SPAN&gt;&lt;SPAN&gt;leared when the cluster is terminated or when local SSD storage is needed for something else.&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Best for:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;Repeated reads of &lt;/SPAN&gt;&lt;STRONG&gt;the same files&lt;/STRONG&gt;&lt;SPAN&gt; from cloud storage across different jobs or notebooks, i&lt;/SPAN&gt;mproving read performance from Delta tables and Parquet files&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Trigger:&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;No code change, a&lt;/SPAN&gt;&lt;SPAN&gt;utomatic on &lt;/SPAN&gt;&lt;STRONG&gt;DBR &amp;gt;= 10.4,&lt;/STRONG&gt;&amp;nbsp;enabled via &lt;STRONG&gt;spark.databricks.io.cache.enabled true&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Why Together = Best Performance&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Disk caching&lt;/STRONG&gt; = reduces &lt;STRONG&gt;cloud I/O latency&lt;/STRONG&gt; (cluster-wide).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Spark caching&lt;/STRONG&gt; = reduces &lt;STRONG&gt;recomputation overhead&lt;/STRONG&gt; (job-specific).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Coffee77_0-1756394294274.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19448i12783E77C313E68B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Coffee77_0-1756394294274.jpeg" alt="Coffee77_0-1756394294274.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using both ensures:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Faster &lt;STRONG&gt;initial reads&lt;/STRONG&gt;&amp;nbsp;thanks to SSD cache.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Faster &lt;STRONG&gt;subsequent transformations&lt;/STRONG&gt; and iterative operations thanks to Spark memory and/or cache.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 15:42:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/community-articles/spark-caching-vs-databricks-disk-caching/m-p/130056#M624</guid>
      <dc:creator>Coffee77</dc:creator>
      <dc:date>2025-08-28T15:42:49Z</dc:date>
    </item>
  </channel>
</rss>

