When a Spark job is slow, find the stage that takes the time before you change anything. The Spark UI lists jobs, stages and tasks. Each stage shows input, shuffle read and write, and spill. Spill means a task's data did not fit in memory and went to disk. The SQL tab draws the query plan as a directed acyclic graph (DAG), where an Exchange node is a shuffle that moves data between executors. For SQL warehouses and serverless compute, the query profile shows time and rows per operator.
Typical fixes follow the evidence. Spill calls for smaller partitions or more memory per core. A large shuffle to join a small table calls for a broadcast join. A cache that is used once only takes memory from the work that needs it.
Cost and logs have their own tools. The system.billing.usage table records consumption by workspace, product and job. Diagnostic settings on the Azure Databricks workspace send job and cluster logs to a Log Analytics workspace, where Azure Monitor alert rules can notify people.
Spill happens per task. Smaller partitions or more memory per task keep the data in memory.