spark-optimization

Tune Spark partitioning, memory, and shuffle settings to optimize job performance.

4|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/AI-Foundry-Core/ril-agents --skill spark-optimization-ai-foundry-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spark-optimization
Source: https://github.com/AI-Foundry-Core/ril-agents/tree/main/plugins/data-engineering/skills/spark-optimization
Command: npx skills add https://github.com/AI-Foundry-Core/ril-agents --skill spark-optimization-ai-foundry-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Spark performance issues can cause slow data pipelines and higher cost; this Skill provides guidance to optimize Spark jobs through partitioning, memory management, and shuffle tuning to improve throughput and efficiency.

Core Features & Use Cases

  • Partitioning strategies to improve parallelism and reduce data skew
  • Memory tuning and cache management to minimize spills and GC overhead
  • Shuffle optimization and AQE settings to reduce shuffle cost in large pipelines
  • Real-world use cases include large batch ETL, streaming aggregations, and iterative machine learning workloads

Quick Start

Run the Spark optimization pattern to apply the recommended partitioning, memory, and shuffle settings on your Spark cluster.

Frequently Asked Questions about spark-optimization

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

FAQPage Schema
Why does my Spark job take so long to run and how do I fix it?

Slow Spark jobs often result from suboptimal partitioning, memory pressure, or heavy shuffle operations. You can resolve Spark performance issues by tuning partitioning, memory management, and shuffle settings to improve throughput and reduce execution time.

How do I tune Spark shuffle partitions to handle large data pipelines?

Tune Spark shuffle partitions by adjusting spark.sql.shuffle.partitions and enabling Adaptive Query Execution (AQE). These settings reduce shuffle cost and improve parallelism, which is especially effective for large batch ETL and streaming aggregations.

What is the best way to resolve data skew in Apache Spark?

The best way to resolve data skew in Apache Spark is to apply targeted partitioning strategies that improve parallelism. Adjusting AQE settings further balances workload distribution and reduces skewed shuffle behavior across large pipelines.

How do I reduce GC overhead and memory spills in Spark executors?

Reduce GC overhead and memory spills in Spark executors by applying memory tuning and cache management. Configuring spark.executor.memory properly minimizes garbage collection pauses and prevents disk spills during large-scale data processing.

Can I use these Spark optimization patterns for streaming and machine learning workloads?

Yes, these Spark optimization patterns support streaming aggregations and iterative machine learning workloads. Tuning memory, partitioning, and shuffle behavior applies broadly across batch ETL, streaming pipelines, and data-intensive iterative processes.