Spark · medium · ~12 min
A feature-engineering job applies ~300 transformations to a DataFrame in a Python for loop — one enrichment per feature family, same data volume throughout.
for
Each iteration is slower than the last. By iteration 200 the job spends more time *between* stages than in them, and the Spark UI gives up rendering the SQL DAG entirely. Data volume is flat.
A teammate added cache() every 10 iterations — no improvement. Another found a benchmark showing localCheckpoint() is the fastest lineage fix and wants to ship it today. The job runs on spot executors with dynamic allocation.
cache()
localCheckpoint()