Domain 4 of 4 · Chapter 4 of 4

Monitoring, Troubleshooting, and Optimizing Workloads

Unlock the complete study guide + 24 practice exams totaling 1,424 questions.

Bundled into the existing Implementing Data Engineering Solutions Using Azure Databricks premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • Match the diagnostic lens to the symptom
  • Read the Spark UI: scale up versus scale out
  • Cache for reuse: disk cache versus Spark cache
  • Fix skew, spill, and shuffle
  • Maintain Delta tables: OPTIMIZE, cluster, VACUUM
  • Control and attribute compute cost
  • Recover a failed job run
  • Centralize monitoring with Azure Monitor
  • Exam-pattern recognition

Compute cost levers and what each one actually controls

Compute cost controlAuto-terminationAutoscalingCluster poolAzure Spot VMs
What it changesstops an idle clusterworker count (min to max)warm idle instancesworker VM price
Cost effectremoves idle DBU and VM costmatches capacity to loadcuts cluster start latencylower price for interruptible work
Main caveatonly affects idle clustersnever stops an idle clusteryou pay for warm idle instancesinstances can be evicted mid-run

Decision tree

Cost or DBU spend?system.billing.usage+ tags for attributionDid a job run fail?Run matrix viewthen Repair runSlow SQL warehouse query?SQL query profileSlow notebook / cluster job?Spark UIskew / spill / shuffleAzure Monitor + Log Analyticscentralize alerting on any of the aboveYesNoYesNoYesNoYesElse

Cheat sheet

  • Auto termination stops an idle all-purpose cluster to remove idle cost
  • Autoscaling, pools, and spot instances trade cost against latency and interruption
  • System tables and tags attribute DBU consumption to workloads
  • Photon can improve price-performance despite a higher DBU rate
  • Repair run re-executes only the failed and dependent tasks
  • Repairing a non-idempotent task can duplicate its output
  • The run matrix view exposes per-task status and logs to locate a failure
  • Stop cancels an in-progress job run; Run now re-triggers or backfills
  • Use the Spark UI to decide whether to scale up or scale out
  • Driver out-of-memory from large collects may require a cluster restart
  • Verify Photon and an appropriate runtime version for performance work
  • Data skew creates stragglers that AQE or salting can relieve
  • Spill is data overflowing executor memory onto disk
  • Shuffle moves data across the network; broadcast joins avoid it for small tables
  • Disk cache and Spark cache serve different reuse patterns
  • The SQL query profile diagnoses slow SQL warehouse queries
  • OPTIMIZE compacts the many small files that frequent DML creates
  • VACUUM deletes unreferenced files beyond the retention window
  • Liquid clustering (CLUSTER BY) is the recommended alternative to partitioning plus ZORDER
  • Predictive optimization automates OPTIMIZE and VACUUM on managed tables
  • Diagnostic settings stream operational logs for troubleshooting
  • Azure Monitor alert rules fire actions on log or metric thresholds
  • The spark-monitoring GitHub library is legacy and in maintenance mode
  • By default the pipeline event log is a hidden table readable only by the pipeline's run-as user through the event_log() function
  • Expectation metrics are recorded for the warn and drop actions but not for fail, because the update never completes
  • Restarting a terminated compute replaces its Spark UI with the new instance, and an unpinned terminated compute is deleted after a bounded retention window
  • The compute event log records only that init scripts started and finished, so the failing script's output requires log delivery configured before the launch
  • Photon is always on for serverless compute, SQL warehouses and serverless pipelines, and is a per-compute choice only on classic all-purpose, jobs and pipeline compute
  • Photon earns its higher DBU rate only when rate multiplied by elapsed time falls, which happens on large scans, joins, aggregations and Delta writes but not on UDF, RDD or stateful streaming work
  • An operation Photon cannot run falls back to the Spark runtime transparently, so a bad fit announces itself only as unchanged runtime at a higher bill
  • A stream that is falling behind stays RUNNING with no failed task, so the verdict comes from the per-micro-batch progress report rather than from run state
  • A backlog proves the query is losing ground only when it grows monotonically, not when it is merely non-zero
  • The remedy for a lagging stream is a choice between bounding what each micro-batch admits, giving the query steadier compute, and moving it onto a runtime that scales the stream for you

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. Debugging with the Spark UI
  2. Query profile
  3. Troubleshoot and repair job failures
  4. Billable usage system table reference
  5. Configure diagnostic log delivery
  6. Compute configuration reference
  7. What is Photon?
  8. Optimize performance with caching on Azure Databricks
  9. Diagnose cost and performance issues using the Spark UI
  10. Adaptive query execution
  11. Optimize data file layout
  12. Use liquid clustering for tables
  13. Remove unused data files with vacuum
  14. Predictive optimization for Unity Catalog managed tables
  15. Pool best practices
  16. Trigger a single job run
  17. Overview of Azure Monitor alerts