DP-203 · Question #427
You have an Azure subscription that contains an Azure Data Lake Storage Gen2 container named Container1 and an Azure Synapse Analytics workspace named Workspace1. Workspace1 contains multiple Apache S
The correct answer is B. Cache the dataset.. When multiple Spark jobs repeatedly read the same large dataset from ADLS Gen2, persisting that dataset in memory via caching eliminates redundant storage I/O and significantly reduces job run times.
Question
You have an Azure subscription that contains an Azure Data Lake Storage Gen2 container named Container1 and an Azure Synapse Analytics workspace named Workspace1. Workspace1 contains multiple Apache Spark jobs that reference a large dataset in Container1. You need to optimize the run times of the jobs. What should you do?
Options
- AFor Container1, disable hierarchical namespaces.
- BCache the dataset.
- CIncrease the spark.sql.autoBroadcastJoinThreshold value.
- DUse Resilient Distributed Datasets (RDDs).
How the community answered
(42 responses)- A2% (1)
- B79% (33)
- C14% (6)
- D5% (2)
Why each option
When multiple Spark jobs repeatedly read the same large dataset from ADLS Gen2, persisting that dataset in memory via caching eliminates redundant storage I/O and significantly reduces job run times.
Disabling hierarchical namespaces on an ADLS Gen2 container removes directory-level operations and would degrade, not improve, performance for workloads that rely on directory semantics.
Spark's DataFrame.cache() (or persist()) stores the dataset in executor memory after the first read, so subsequent jobs or actions access in-memory data instead of re-reading from ADLS Gen2, directly reducing the I/O bottleneck that slows repeated reads of a large shared dataset.
Increasing spark.sql.autoBroadcastJoinThreshold allows larger tables to be broadcast in join operations, which optimizes join performance but does not address repeated full reads of a large shared dataset.
Using RDDs instead of DataFrames bypasses Spark's Catalyst optimizer and Tungsten execution engine, which typically results in worse, not better, performance for large datasets.
Concept tested: Caching shared datasets to optimize Spark job performance
Source: https://learn.microsoft.com/en-us/azure/synapse-analytics/spark/apache-spark-performance
Topics
Community Discussion
No community discussion yet for this question.