spark-optimization

Optimize Apache Spark job performance by reducing shuffle bottlenecks and tuning partitioning, joins, and memory.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/Jhabbig/Habbig --skill spark-optimization-jhabbig
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spark-optimization
Source: https://github.com/Jhabbig/Habbig/tree/main/.claude/plugins/wshobson/data-engineering/skills/spark-optimization
Command: npx skills add https://github.com/Jhabbig/Habbig --skill spark-optimization-jhabbig

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you diagnose and fix slow Apache Spark jobs by reducing shuffle overhead, improving partitioning, tuning memory, and eliminating common performance bottlenecks in large-scale data pipelines.

Core Features & Use Cases

  • Partitioning Strategy: Choose balanced partition sizes, repartition when needed, and coalesce safely to improve parallelism without unnecessary shuffles.
  • Join and Shuffle Tuning: Apply broadcast joins, skew handling, pre-aggregation, and shuffle compression to speed up expensive transformations.
  • Memory and Persistence: Tune executor memory, persistence levels, and checkpointing to control garbage collection pressure and avoid spills.
  • Data Format and Query Optimization: Use Parquet, Delta, column pruning, predicate pushdown, and adaptive query execution for better scan and query efficiency.
  • Monitoring and Debugging: Inspect query plans, stage metrics, and partition skew to identify why a job is slow and verify the fix.

Quick Start

Ask for an optimization plan for your Spark job, including recommended partition counts, join strategy, memory settings, and shuffle reductions based on the current pipeline description.

Frequently Asked Questions about spark-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce shuffle overhead in slow Apache Spark jobs?

Reduce Spark shuffle overhead by applying broadcast joins, skew handling, pre-aggregation, and shuffle compression to speed up expensive transformations. Analyzing query plans and stage metrics helps identify and eliminate shuffle bottlenecks.

What is the best way to tune Spark executor memory and avoid disk spills?

Tune Spark executor memory and avoid spills by adjusting memory-aware configurations, selecting appropriate persistence levels, and applying checkpointing to control garbage collection pressure during large-scale data processing.

How do I fix partition skew and rebalance partitioning in Spark data pipelines?

Fix partition skew by choosing balanced partition sizes, repartitioning when needed, and safely coalescing to improve parallelism. Inspecting stage metrics and query plans verifies that right-sized partitions resolve the skew.

When should I use adaptive query execution and Parquet format for Spark optimization?

Use adaptive query execution and Parquet format when you need better scan and query efficiency. Combine them with column pruning and predicate pushdown to optimize data processing reliability and reduce scan times.

Does this Spark optimization approach work for both batch and streaming pipelines?

Yes, this Spark optimization approach works for both batch and streaming pipelines. It requires adaptive query execution, broadcast and skew join handling, and memory-aware configurations to scale data processing reliably across both workloads.