wshobson avatar

Spark Optimization

If your Spark jobs are crawling or crashing, this gives you the exact patterns to fix them. It covers the critical stuff: calculating optimal partition sizes, implementing broadcast joins versus sort-merge joins, setting up proper caching with storage levels, and tuning executor memory configurations. The salting technique for handling data skew is especially useful when you have hot keys killing performance. It includes actual configuration values and memory breakdowns, not just theory. Most helpful when you're dealing with production workloads that need to scale beyond toy datasets.

skills.sh installs
11.1K
GitHub stars
42.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add wshobson/agents --skill spark-optimization --agent claude-code

Installs into .claude/skills of the current project.

Files

Apache Spark Optimization

Production patterns for optimizing Apache Spark jobs including partitioning strategies, memory management, shuffle optimization, and performance tuning.

When to Use This Skill

  • Optimizing slow Spark jobs
  • Tuning memory and executor configuration
  • Implementing efficient partitioning strategies
  • Debugging Spark performance issues
  • Scaling Spark pipelines for large datasets
  • Reducing shuffle and data skew

Core Concepts

1. Spark Execution Model

Driver Program
    ↓
Job (triggered by action)
    ↓
Stages (separated by shuffles)
    ↓
Tasks (one per partition)

2. Key Performance Factors

FactorImpactSolution
ShuffleNetwork I/O, disk I/OMinimize wide transformations
Data SkewUneven task durationSalting, broadcast joins
SerializationCPU overheadUse Kryo, columnar formats
MemoryGC pressure, spillsTune executor memory
PartitionsParallelismRight-size partitions

Sponsors

Details

Repository
github.com/wshobson/agents
Category
Debugging

More from wshobson/agents

All 174

Recommended

More Debugging
1apify avatarapify-actor-developmentapify/agent-skillsDevelop, debug, and deploy Apify Actors - serverless cloud programs for web scraping, automation, and data processing. Use when creating new Actors, modifying e10.9Kskills.sh installs
2aws avataraws-serverlessaws/agent-toolkit-for-awsBuilds, deploys, manages, debugs, configures, and optimizes serverless applications on AWS using Lambda, API Gateway, Step Functions, EventBridge, and SAM/CDK. 10.9Kskills.sh installs
3wshobson avatarslo-implementationwshobson/agentsDefine and implement Service Level Indicators (SLIs) and Service Level Objectives (SLOs) with error budgets and alerting. Use when establishing reliability targ10.8Kskills.sh installs
4msw-git avatarmsw-scriptingmsw-git/msw-ai-coding-plugins-officialAuthoring MSW scripts (.mlua) plus integrated playtest and debugging. Covers mlua syntax, annotations (@Component/@Logic/@ExecSpace/@Sync), lifecycle, exec spac10.7Kskills.sh installs
5aws avataraws-containersaws/agent-toolkit-for-awsDeploys and operates containerized workloads on ECS, Fargate, and ECR. Covers task definitions, Fargate services, ECR repository setup and lifecycle policies, E10.1Kskills.sh installs
6anthropics avatarcode-reviewanthropics/knowledge-work-pluginsReview code changes for security, performance, and correctness. Trigger with a PR URL or diff, "review this before I merge", "is this code safe?", or when check10.1Kskills.sh installs