/oracle-ai-data-platform-workbench-engineer-agent:aidp-spark-optimizationfrom oracle-ai-data-platform-workbench-engineer-agent
Tunes Apache Spark 3.5.0 and Delta Lake workloads by diagnosing and fixing slow stages, skew, spill, small files, and shuffle issues using Spark UI metrics and config tuning.
Ships in oracle-ai-data-platform-workbench-engineer-agent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Field-tested techniques for optimizing open-source Apache Spark 3.5.0 (and open-source Delta Lake) workloads. Every technique lists what it does, why it matters, patterns (when it helps), anti-patterns (when it does not help or hurts), the exact config/code, and impact evidence from real reproductions.
Applies to plain OSS Spark 3.5.0. Vendor-only features (Databricks Photon / predictive optimization / Delta disk cache, AWS Glue/EMR runtime tricks) are excluded or explicitly flagged. (Note: Delta Lake liquid clustering, OPTIMIZE/ZORDER, deletion vectors, CDF are open-source — GA in Delta 3.2.0 — see references/08-delta-lake.md.) Some examples run on the Oracle AI Data Platform (AIDP); AIDP-specific execution rules are in references/aidp-notes.md.
In this plugin (
oracle-ai-data-platform-workbench-engineer-agent): measure/apply on AIDP via the bundledscripts/aidp_sql.py(one SparkSession per cluster -- set/revertspark.confexplicitly; seereferences/aidp-notes.md); pull Spark-UI stage/task metrics via theaidp-spark-debuggingskill; right-size compute + set cluster-create-only configs (e.g.spark.memory.fraction) viaaidp-cluster-ops; run DeltaOPTIMIZE/VACUUM/ZORDERDDL viaaidp-sql-ddl/aidp-table-management. Adapted from theai-data-engineer-agentspark-optimizationskill (Oracle).
Optimization is a measurement loop, not a guess. Detect → diagnose → propose → apply → re-run on the same data → compare the same metrics.
Most Spark time is lost to moving data (shuffle), waiting on a straggler (skew), spilling (under-memory), doing redundant work (re-reads, re-materialization, repeated actions), or per-row execution overhead (wide codegen). Almost every win below reduces one of those.
p100/p50 > 2x skew, large shuffle read/write, memory/disk spill, high GC, or thousands of tiny tasks/files.union of the same table, a driver loop calling collect()/head()/count() repeatedly, MERGE on a huge table, wide groupBy (100+ fields), reading 100k+ small files, an un-filtered join with a big dimension.references/09-oracle-database.md)When NOT to use: correctness bugs (use debugging), or sub-second jobs where tuning effort exceeds the payoff. Structured Streaming engine tuning (trigger interval, maxOffsetsPerTrigger, state store) is out of scope here — but each micro-batch is batch-shaped, so the join/skew/partition/file/codegen techniques below apply per batch.
digraph route {
rankdir=LR; node [shape=box];
sym [shape=diamond, label="Dominant symptom?"];
sym -> "references/diagnosis.md" [label="not sure / need to measure"];
sym -> "references/02-joins.md" [label="slow join, skew, SortMergeJoin"];
sym -> "references/04-memory-and-spill.md" [label="spill, OOM, lost executors, GC"];
sym -> "references/cluster-sizing.md" [label="right-size compute: workers/OCPU/RAM"];
sym -> "references/03-file-layout-io.md" [label="many small files, slow scan, listing"];
sym -> "references/01-partitioning.md" [label="too many/few partitions, weak parallelism"];
sym -> "references/05-codegen.md" [label="CPU-bound wide aggregation"];
sym -> "references/06-caching-materialization.md" [label="re-reads, union, driver loop, MERGE"];
sym -> "references/07-aqe.md" [label="want runtime adaptivity"];
sym -> "references/08-delta-lake.md" [label="Delta table: small files, OPTIMIZE/ZORDER/clustering, VACUUM, deletion vectors, CDF"];
sym -> "references/09-oracle-database.md" [label="read/write Oracle DB / ADW / Exadata (JDBC parallelism, redo, complex types)"];
}
Then consult references/config-matrix.md for the exact key, default, impact, and where it can be set (notebook / cluster-create-only / non-modifiable), and references/quick-reference.md for the impact-ranked checklist.
| File | Covers |
|---|---|
references/diagnosis.md | How to find & measure opportunities from the Spark UI: symptom→cause, skew ratio, which metrics, query→stage timing. |
references/01-partitioning.md | Partition counts, parallelism, shuffle.partitions, AQE coalescing, tiny/empty partitions, repartition vs coalesce. |
references/02-joins.md | Broadcast join, Shuffle-Hash vs Sort-Merge, skew handling, semi-join pre-filter, salting. |
references/03-file-layout-io.md | Small-file problem, openCostInBytes/maxPartitionBytes, compaction/OPTIMIZE, partitionOverwriteMode, gzip splittability, compression (zstd). |
references/04-memory-and-spill.md | Spark memory model, memory.fraction, spill detection/fix, off-heap, the gzip-4x rule. |
references/cluster-sizing.md | Right-size AIDP compute: workers x OCPU x RAM, parallelism vs memory, observed-run → recommendation. |
references/05-codegen.md | WholeStage codegen, codegen.maxFields, when generated code is slower. |
references/06-caching-materialization.md | Caching & cache layout, avoid unnecessary materialization, union-of-same-table, driver-loop, JOIN-over-MERGE. |
references/07-aqe.md | Adaptive Query Execution: coalesce, skew join, the threshold interplay. |
references/08-delta-lake.md | Delta Lake 3.2.0: OPTIMIZE/compaction (+VACUUM dependency), optimized writes, auto-compaction, ZORDER, liquid clustering, deletion vectors, CDF, data skipping, file sizing; the optimizeWrite+zstd+binSize recipe. |
references/09-oracle-database.md | Oracle DB (ADW/ATP/Exadata): parallel JDBC reads (partitionColumn, fetchsize), bulk (COPY_DATA, ADW-only) vs conventional-JDBC writes, the redo-log / NOLOGGING field case + tradeoffs, complex types (JSON-as-VARCHAR2), Storage Partition Join. |
references/config-matrix.md | Master config table: default, impact, and where-settable classification. |
references/case-studies.md | Real before/after numbers (field engagements + AIDP reproductions). |
references/quick-reference.md | Impact-ranked checklist + symptom→technique lookup. |
references/aidp-notes.md | AIDP execution model + how to set/revert configs safely (one SparkSession per cluster) + collect-metrics-early. |
Ranked by typical payoff (full details + caveats in the referenced files):
spark.sql.autoBroadcastJoinThreshold so a small/medium side broadcasts; or semi-join pre-filter the big dimension down to broadcastable size. (02-joins.md)maxPartitionBytes + openCostInBytes. Listing+opening 100k+ files can cost more than the data. (03-file-layout-io.md)spark.memory.fraction (cluster-create-only on AIDP) when there are no user data structures; spill to disk is a silent multiplier. (04-memory-and-spill.md, cluster-sizing.md)p100/p50 > 2x join stage serializes the whole stage on a straggler. (02-joins.md, 07-aqe.md)union the same table, don't loop collect()/head() on the driver, treat intermediates as views (don't materialize), prefer JOIN over MERGE for full reloads. (06-caching-materialization.md)spark.io.compression.codec=zstd + spark.sql.parquet.compression.codec=zstd: tight like gzip, fast like snappy; cuts spill-disk and output size. (03-file-layout-io.md)shuffle.partitions ≈ 2–3× total cores for large shuffles; pair with AQE coalescing to avoid small output files. (01-partitioning.md)spark.sql.codegen.maxFields when a wide groupBy is CPU-bound; generated code can be slower than the fallback. (05-codegen.md)diagnosis.md). On AIDP, see aidp-notes.md for collecting Spark UI data.explain(True)/the SQL plan; map the dominant symptom to a technique.config-matrix.md for where the config can be set.spark.conf.set leaks to other notebooks; revert it explicitly (aidp-notes.md).repartition() "to be safe" — it forces a shuffle; only repartition with a reason (see 01-partitioning.md).spark.memory.fraction) from a notebook and assuming it took effect — it didn't. Verify with spark.conf.get / the Environment tab (config-matrix.md).references/01-partitioning.md (opens in a new tab)references/02-joins.md (opens in a new tab)references/03-file-layout-io.md (opens in a new tab)references/04-memory-and-spill.md (opens in a new tab)references/05-codegen.md (opens in a new tab)references/06-caching-materialization.md (opens in a new tab)references/07-aqe.md (opens in a new tab)references/08-delta-lake.md (opens in a new tab)references/09-oracle-database.md (opens in a new tab)references/aidp-notes.md (opens in a new tab)references/case-studies.md (opens in a new tab)references/cluster-sizing.md (opens in a new tab)references/config-matrix.md (opens in a new tab)references/diagnosis.md (opens in a new tab)references/quick-reference.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
spark-optimization, delta-lake, performance-tuning, spark-ui, shuffle-tuning, aqe
37 skills in this plugin
/aidp-agent-flowsDiscover, author, deploy, and run AIDP agent flows. Use when the user wants to list/inspect agent flows, or create/update/deploy/run a flow, manage sessions/guardrails, attach compute, or attach a remote MCP server to a flow (an MCP_TOOL node — AIDP's "Native MCP Client Support" LA feature, where the flow connects OUT to OAC/ADW/OIC/any MCP-compatible service). Everything runs over the Limited-Availability AgentFlows REST API via `oci raw-request`; verify live first. (An `aidp` MCP `list_agent_flows`, if configured, is an optional read accelerator only.)/aidp-agent-highcodeBuild AIDP agents in high-code Python with aidputils + LangGraph (the code-first alternative to the low-code agent-flow canvas). Use when the user wants to write an agent in Python, use LangGraph / create_react_agent / StateGraph, call aidputils (OCIAIConf, AIDPToolConf, init_oci_llm, create_langgraph_tool), build a custom or multi-agent supervisor flow in code, or asks "how do I code an AIDP agent". For the low-code/REST node-graph path use aidp-agent-flows./aidp-ai-sqlRun LLM functions inside Spark SQL on AIDP via ai_generate(). Use when the user wants to summarize/classify/extract/enrich rows with an LLM directly in SQL, generate narratives over aggregated results, or do grounded RAG-style analysis in the lakehouse. Signature is model-first; available models must be confirmed live before relying on it./aidp-analyzing-dataAnswer business questions over the AIDP lakehouse with Spark SQL. Use when the user asks a data question ("how many…", "top N…", "show me…", "trend of…", "revenue by…") or wants to run ad-hoc Spark SQL. Grounds in .aidp/catalog.md + .aidp/semantic.md and reuses validated verified queries before generating SQL, then executes via the bundled aidp_sql.py helper./aidp-auditManage and search AIDP audit logs — enable/disable auditing, set retention, and query audit-log entries for a DataLake. Use when the user asks about audit logging, who did what, compliance/retention of AIDP activity, or wants to search audit events. Self-contained — official `aidp audit` CLI preferred, `oci raw-request` fallback./aidp-bundleDeploy AIDP resources as a bundle — create a bundle, deploy all its assets atomically, query deployment status, and purge. Use when the user wants to promote/deploy a set of AIDP resources together, manage a deployment bundle, check bundle deployment status, or tear one down. Preview API via `oci raw-request`; verify live first.2 plugins ship this exact skill · first indexed Jun 12, 2026
claude plugin install oracle-ai-data-platform-workbench-engineer-agent@claude-plugins-officialOther plugins' skills for the same job