Skip to content
Preptima
hardScenarioConceptMidSeniorStaff

A Spark job that used to finish in ten minutes now takes two hours. How do you find out why?

A slow Spark job should be diagnosed from the Spark UI stage list, task duration spread, shuffle volume and physical plan. Common causes are data skew, unnecessary shuffles, missed broadcast joins, repeated recomputation and collect() pulling too much data to the driver.

6 min readUpdated 2026-08-15

Answer

Short answer

Start in the Spark UI, not in the code. Find the slow stage, compare max task time to median task time, inspect shuffle read/write and confirm the physical plan; skew, shuffle, recomputation and driver collect() are the usual culprits.

Was this answer helpful?

Likely follow-ups

  • You confirm one key holds 60% of the rows. What are your options, and what does each cost?
  • When is repartition the wrong tool and coalesce the right one, and when is that reversed?
  • Adaptive query execution is already on. What classes of problem does it still not solve?
  • The same job is fast on the sample and slow in production with identical code. Where do you look?

Related questions

Further reading