Skip to content

Introduction ​

This guide is a hands-on reference for optimizing Spark and PySpark jobs. It covers Spark internals, memory management, joins, shuffle, data formats, PySpark-specific patterns, Adaptive Query Execution (AQE), and cluster tuning, followed by a bottleneck diagnostic reference.

Read it top to bottom for a full grounding in Spark performance, or jump straight to the Bottleneck Reference section below when you already know which symptom you're chasing.

Severity dots ​

Each finding is marked with a severity dot:

  • Info: worth knowing, not yet a problem
  • Warning: likely hurting job performance
  • Critical: actively bottlenecking the job

Each bottleneck section below documents the exact thresholds behind these dots.

Native engines and managed platforms ​

This reference describes Spark's JVM execution as the Spark documentation defines it. The Native Engines group has one page each for Photon, Apache Gluten and Apache DataFusion Comet. Where a managed platform (Databricks, Amazon EMR, AWS Glue, Google Cloud's managed Spark service) changes the advice, the page carries a Managed platforms note that cites the vendor documentation. The Gluten and Comet pages follow each project's unversioned documentation, so check them against the version you run.

Tag system ​

Every bottleneck has a short tag used throughout this reference:

SKEW SHFL SPILLGC COLD UTILHOST FAIL STRAGRETRY TINY FAIL-RATE

See the Bottleneck Reference for what each one means, how it's detected, and how to fix it.