QuestionQ86

VerifiedCost & Performance Optimisation

A query is taking too long to complete. After examining the Spark UI, the data engineer found a substantial amount of disk spill. The compute instance type used by the data engineer provides only a 1:2 core-to-memory ratio.

Which two actions should the data engineer take to minimize spillage?

Choose two
Explanation

Disk spilling is caused by insufficient execution memory for a task’s working data. Smaller file-read partitions reduce the amount of input handled by each task, lowering its memory requirement. A compute instance with more memory relative to its cores provides more execution memory capacity per concurrent task, which further reduces memory pressure and disk spill. Spark documents that spark.sql.files.maxPartitionBytes is the maximum number of bytes packed into one file-read partition and that limited execution memory leads to spills.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!