What you will be able to do
- Explain how a serverless base environment version and a declared dependency list define what a notebook or job task runs on
- Declare serverless dependencies from PyPI, workspace files and Unity Catalog volumes, pinned so that runs can be reproduced
- Recognise what serverless compute will not let you configure: init scripts, compute policies, compute-scoped environment variables and arbitrary Spark configs
- Choose between performance-optimized and standard serverless performance mode for jobs, pipelines and notebooks
- Decide when a notebook task needs High memory, and when to turn off serverless auto-optimization for a non-idempotent task
Key concept
Serverless environment version — On serverless compute you do not pick a Databricks Runtime. You pick a versioned base environment that sets the Python version and the pre-installed libraries, then you declare any extra dependencies on top of it. Databricks upgrades the servers underneath without breaking that client-side contract.
1.Environment versions replace runtime versions
On classic compute you choose a Databricks Runtime version and own every upgrade. Serverless compute takes that decision away from you. Your code targets an environment version, which is a stable client API, and Databricks delivers performance improvements, security fixes and bug fixes on the server side without any change to your workload. Each environment version is supported for three years from its release, so the upgrade path is predictable.
The environment version is set by the base environment, which decides the pre-installed libraries and the Python version. In a serverless notebook you choose it from the Base environment selector in the Environment side pane. The selector offers these options:
- Standard, the default environment with Databricks-provided libraries.
- ML, which adds the Python and system packages from Databricks Runtime for Machine Learning. Use it to move classic ML workloads onto serverless.
- More, which opens previous versions of Standard, ML and AI, plus Custom, an environment you specify in a YAML file.
- Workspace environments, base environments that an administrator has configured for the workspace.
Databricks recommends the latest version, because that is where new notebook features arrive.
Jobs follow the same model. Every task runs in an isolated environment made of a base environment plus the libraries you add, and the task inherits whatever its environment version installs by default. A notebook task uses Notebook Environment unless you say otherwise, meaning the notebook's own base environment and dependencies apply. You can override that with a job-level environment. In a job definition, each environment has a unique key and a spec, and the spec carries a required version string and a list of pip dependencies.
| Key | Meaning |
|---|---|
| environment_key | Key of the environment; must be unique within a job |
| spec | The entity that represents a serverless environment |
| environment_version | Inside spec. Required. Each version comes with a specific Python version and a set of Python packages |
| dependencies | Inside spec. List of pip dependencies, as supported by the version of pip in this environment |
| client | Inside spec. Deprecated. The client version |
For Python notebooks the environment can travel with the file. If you turn on Include in source file exports, the base environment and dependencies are written into the exported source in PEP 723 inline-metadata format. The environment configuration then survives when the notebook lives in a Git folder or is downloaded as source.
# Databricks notebook source
# /// script
# [tool.databricks.environment]
# environment_version = "5"
# ///
print("Hello World!")Checkpoint 1 of 9· Fill the gap
A Python notebook on serverless compute has Include in source file exports turned on. On serverless you don't pick a Databricks Runtime, so which key in the exported inline metadata pins the notebook's environment?
# Databricks notebook source
# /// script
# [tool.databricks.environment]
# ? = "5"
# ///
print("Hello World!")Serverless code targets an environment version, not a Databricks Runtime version. The export records it as environment_version, the same required field as spec.environment_version in a job environment. The client field is deprecated.
Source: docs.databricks.com2.Declaring and caching dependencies
A serverless dependency is a line you would write in requirements.txt. You add it in the Dependencies section of the Environment side pane and click Apply, which installs it and restarts the Python process. An entry can be a PyPI package, a Python wheel, or a Python project directory that contains a pyproject.toml or setup.py. Wheels and projects can sit in workspace files, using an absolute path that starts with /Workspace/, or in a Unity Catalog volume, using /Volumes/<catalog>/<schema>/<volume>/<path>.whl. For a private or authenticated repository, put index-url or extra-index-url in the dependency specification. A workspace admin can also make that repository the default pip source.
Installation happens before any of your code runs. Databricks resolves and installs the declared dependencies first, so a notebook cell has no way to change how packages are fetched. Setting a proxy variable at runtime is a common attempt, and it does nothing. Everything about installation belongs in the dependency spec.
The installed virtual environment is cached. Reopening a notebook, or coming back after an inactivity disconnect, does not reinstall its packages. Within a job run, a task that shares its dependency set with a completed task finishes faster because the cache already holds those packages. The cache causes one failure that is easy to miss. If you change the code of a custom Python package used by a serverless job but leave its version number unchanged, the job can keep running the old implementation. Bump the version every time you change the package. In a notebook, Reset to defaults under the Apply arrow clears the cache and does a fresh install. Starting a new session does not clear it completely.
Pin versions explicitly. An unpinned package can resolve to a different version depending on the serverless environment version, so builds stop being reproducible and startup slows down while new packages install.
numpy==2.2.2
pandas==2.2.3After you have tuned an environment, you can reuse it. Export environment in the pane's menu saves the base environment and dependencies as a YAML specification in a workspace file or a volume. Other notebooks load it with Custom in the Base environment selector. When an install fails, for example because of an architecture-specific wheel or a package that pulls in PySpark, see troubleshooting serverless dependency failures.
Checkpoint 2 of 9· Check yourself
A team fixes a bug in a custom Python wheel that a serverless job lists as a dependency. They rebuild the wheel, still labelled version 1.4.0, and overwrite the file at the same volume path. The next run still shows the bug. What should they do so the job runs the fixed code?
Serverless caches the virtual environment, so a changed package with an unchanged version number can keep running the old code. Changing the version number makes the job pick up the new code. Dependencies install before any notebook code runs, and starting a new session does not fully clear the cache.
“If you change the implementation of a custom Python package used in a job on serverless, you must also update its version number”Source: docs.databricks.com
3.What serverless will not let you configure
Serverless takes infrastructure tuning out of your hands. That is why an environment is the only place to put libraries. Several things that classic compute allows are not available:
- Init scripts and compute policies. Custom dependencies have to go through the Environment side pane or a job environment.
- Compute-scoped environment variables. Settings applied at runtime, proxies included, have no effect on dependency installation. Jobs pass environment variables to application code through a separate serverless jobs mechanism.
- Arbitrary Spark configuration. Only the supported parameters on the allowed list can be set, and only at session level, from a notebook in the same job. A run that sets an unsupported one fails.
In return, the platform manages the compute itself. Serverless compute for workflows turns on autoscaling and Photon for you. It keeps adjusting instance types, memory and processing engines to the workload, and any workspace user can run jobs on it without permission to create clusters. It runs in standard access mode on a Unity Catalog-enabled workspace, so your workloads have to support that access mode. Notebook, Python script, dbt, Python wheel and JAR tasks can all use serverless compute, and it is the default compute type when you add one of those task types.
Checkpoint 3 of 9· Check yourself
A platform lead drafts a plan for moving a classic job onto serverless compute for workflows. Which step in the plan will NOT work on serverless?
Dependencies are installed before any notebook code runs, and serverless has no compute-scoped environment variables, so a proxy set at runtime does nothing. Proxy and repository settings belong in the dependency spec, for example index-url. The other steps follow the serverless model: libraries go in the environment, allowed Spark configs are set at session level, and no cluster-creation permission is needed.
“Serverless compute also does not support compute-scoped environment variables, so proxy settings applied at runtime have no effect on dependency installation.”Source: docs.databricks.com
4.Performance mode: startup latency against DBU cost
Serverless performance mode decides whether you pay to have compute ready the moment you need it. Performance-optimized mode, the default, keeps a pool of warm compute ready, so work starts and runs fast. It is built for interactive and time-sensitive work. Standard mode uses less compute. It suits automated batch jobs and pipelines that can accept a startup delay of about 4 to 6 minutes, depending on compute availability and optimized scheduling.
The saving comes from consumption, not from a cheaper price list. Both modes bill on the same SKU. Standard mode consumes fewer DBUs because it uses less compute, which can cut costs by up to 70% compared with performance-optimized mode. A nightly batch job with nobody waiting on it is the typical case for Standard. Moving that job to a classic cluster, or changing its memory tier, does nothing about startup-related spend.
For a job, the Performance optimized toggle sits on the job details page. Turning it off selects standard mode. In the UI the toggle appears only when the job has at least one serverless task, and it changes only those serverless tasks. Classic-compute tasks in the same job are unaffected. Through the CLI and API the same choice is the performance target, with the values PERFORMANCE_OPTIMIZED and STANDARD.
| Aspect | Performance optimized | Standard |
|---|---|---|
| Default? | Yes | No; disable Performance optimized |
| Startup | Fast, from a pool of warm compute | Roughly 4 to 6 minutes |
| DBU consumption | Higher | Lower, up to 70% less; same SKU |
| Available for | Notebooks, Lakeflow Jobs, Lakeflow pipelines | Lakeflow Jobs and Lakeflow pipelines only |
| Best fit | Interactive and time-sensitive work | Scheduled batch jobs and pipelines |
| API/CLI value | PERFORMANCE_OPTIMIZED | STANDARD |
Checkpoint 4 of 9· Check yourself
Every night, an unattended Lakeflow job runs one notebook task on serverless compute and one JAR task on a classic cluster. Nobody minds if it starts a few minutes late, and the owner wants to cut its DBU spend. Which change does that, and what effect does it have?
Turning off the toggle selects standard mode, which suits batch work that can accept a slower start. It uses less compute, so it consumes fewer DBUs on the same SKU, and it applies only to the job's serverless tasks. Neither High memory nor a move to classic compute does anything about startup-related spend.
“Both modes use the same SKU, but standard performance mode consumes fewer DBUs, reflecting lower compute usage.”Source: docs.databricks.com
Checkpoint 5 of 9· Exam question
A data engineering team runs a nightly Lakeflow Job on serverless compute that ingests and transforms roughly 2 TB of data. The job has no interactive users, can tolerate a startup delay of several minutes, and the team wants to minimize DBU spend without rewriting the job's logic. Which change should they make to the job's compute configuration?
Correct answer: B — Configure the job to run in Standard performance mode, accepting a startup delay of roughly four to six minutes in exchange for lower DBU consumption suited to unattended batch runs.
- A. Performance Optimized mode keeps warm compute ready so tasks start in seconds, which is the right trade-off for latency-sensitive interactive work, but it costs more per run than the team needs for an unattended nightly batch job.
- B. Standard performance mode is built for automated batch jobs and pipelines that can absorb a longer startup window, and it can cut DBU cost substantially compared to keeping compute warm, matching exactly what this nightly job needs.
- C. Serverless compute already offers a cost-optimized batch profile through Standard mode, so migrating to a classic autoscaling cluster adds operational overhead without giving the team a capability serverless doesn't already provide.
- D. The memory tier setting controls how much RAM a notebook or notebook task gets and does not select between performance modes, so raising it would not reduce DBU consumption for this ingestion job.
Checkpoint 6 of 9· Exam question
An analyst opens an interactive serverless notebook to explore a sales dataset and needs the compute to start within seconds so they aren't kept waiting between commands. A teammate suggests switching the notebook's compute to Standard performance mode to cut cost. Which statement correctly evaluates that suggestion?
Correct answer: B — The suggestion cannot be applied, because serverless notebooks only support Performance Optimized mode, built for low-latency, always-warm interactive sessions.
- A. Standard performance mode exists for Lakeflow Jobs and Lakeflow Spark Declarative Pipelines, but it is not offered as a selectable option for serverless notebooks, so this evaluation misstates what's configurable.
- B. Serverless notebooks are restricted to Performance Optimized mode precisely because interactive sessions need warm, low-latency compute, which correctly explains why the teammate's suggestion isn't something the analyst can turn on.
- C. Serverless compute does support notebooks as one of its core workload types, so claiming notebooks require classic compute misrepresents the platform's current capabilities.
- D. The memory tier and the performance mode are independent settings in the notebook's Environment panel, so enabling High memory has no bearing on which performance mode is selectable.
5.High-memory notebook tasks and auto-optimization retries
High memory addresses one specific failure: out-of-memory errors in the notebook's own Python process. Picture a pandas DataFrame built on the driver, or a large Python object assembled in a loop. The Memory setting in the Environment side pane switches the notebook from Standard (16 GB total) to High (32 GB total). It enlarges the REPL memory your notebook code runs in. It does not change the memory of the Spark session, so it will not rescue a distributed Spark stage. High memory also has a higher DBU emission rate than standard memory, so turn it on only when the workload needs it.
High memory is set on the notebook, not on the job, and only notebook tasks can use it. A notebook task that runs with the notebook's memory preferences picks the setting up, and a change made in the notebook takes effect on the next job run. Performance mode, retry settings and library versions do not add memory. When the code is correct and a single process needs more room, the Memory setting is the fix. Jobs that need large amounts of memory may also take longer to start, because serverless makes sure enough resources are provisioned first.
Performance mode changes startup latency and DBU consumption, not memory. The fix is High memory in the notebook's Environment side pane, which doubles total memory from 16 GB to 32 GB for the notebook's REPL. The next job run will use it.
Auto-optimization is the serverless feature that tunes the compute behind a job and retries failed tasks. It is on by default, and Databricks recommends keeping it on so that critical workloads complete at least once. Those extra retries become a problem when a task must run at most once. A non-idempotent task, such as one that appends rows without deduplicating or calls an external system that has side effects, can produce duplicates if it is retried after a partial success. For those tasks, open the task's Retry Policy dialog (next to Retries), uncheck Enable serverless auto-optimization (may include additional retries), confirm, and save the task.
Auto-optimization only works on jobs that are saved. A one-time run created with databricks jobs submit is not stored as a job: it does not show up in the UI and is not retried when it fails. With no saved job to act on, Databricks cannot auto-optimize the run's serverless compute, so nothing adjusts its resources and no automatic retry follows a failure. A failed submitted run stays failed until you intervene. There are two ways out. Specify the compute needs yourself on classic compute, where you choose the resources the run gets. Or create the job with jobs create and run it with jobs run-now, which turns it into a saved job that auto-optimization can manage.
Checkpoint 7 of 9· Check yourself
Inside one serverless job, two notebook tasks run out of memory. Task 1 fails while it collects query results into a pandas DataFrame. Task 2 fails during a distributed Spark aggregation stage. The owner sets each notebook's Memory to High. Which failure is this setting meant to fix?
High memory raises the notebook's REPL memory from 16 GB to 32 GB. That helps with driver-side work such as building a pandas DataFrame. It does not change Spark session memory, so it will not rescue a distributed stage, and performance mode adds no memory.
“increases the size of the REPL memory used when running code in the notebook. It doesn't affect the memory size of the Spark session.”Source: docs.databricks.com
Checkpoint 8 of 9· Check yourself
Your saved serverless job has two tasks. The billing task appends rows without deduplicating and calls an external invoicing API. The summary task overwrites a daily summary table. How should auto-optimization be configured?
Auto-optimization may add retries. That protects work that must finish at least once, but a non-idempotent task such as an append or an external API call can produce duplicates if it is retried after a partial success. Turn it off for that task only. A run created with jobs submit is not stored as a job, so it is not auto-optimized at all.
“if you have workloads that must be executed at most once, for example, jobs that are not idempotent, you can turn off auto-optimization”Source: docs.databricks.com
Checkpoint 9 of 9· Exam question
A scheduled notebook task running on serverless compute repeatedly fails with out-of-memory errors while building a large in-memory pandas DataFrame partway through the run. The transformation logic is correct and the team does not want to rewrite it as a distributed Spark job. Which configuration change is most likely to resolve the failure?
Correct answer: A — Open the notebook's Environment side panel and change the Memory setting from Standard to High, which raises the task's total memory from 16 GB to 32 GB.
- A. The Memory setting in the Environment panel is exactly the control for this problem: switching from Standard to High doubles the total memory available to a notebook or notebook job task from 16 GB to 32 GB, giving the pandas workload more headroom.
- B. Performance mode governs startup latency and DBU cost, not the amount of memory allocated to a task, so changing it would not give the pandas transformation any additional headroom.
- C. Auto-optimization controls whether serverless compute can add extra retry attempts for failed tasks; disabling it changes retry behavior but does not reserve or free any memory for the running task.
- D. Pandas version changes do not materially alter the memory ceiling imposed by the notebook's compute tier, so downgrading the library would not address a task that is exceeding its allotted memory.
Sources
(4)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“You write code against an environment version, and Databricks independently upgrades the underlying server.”
↩︎ Environment versions replace runtime versions“Databricks supports each environment version for three years from its release date”
↩︎ Environment versions replace runtime versions“pin your Python packages to specific versions to ensure reproducible environments”
↩︎ Declaring and caching dependencies“Job runs on serverless compute will fail if you set an unsupported Spark configuration.”
↩︎ What serverless will not let you configure“Databricks keeps a pool of warm compute resources ready to minimize wait time.”
↩︎ Performance mode: startup latency against DBU cost“Standard mode can reduce costs by up to 70% compared to performance-optimized mode.”
↩︎ Performance mode: startup latency against DBU cost“You write code against an environment version, and Databricks independently upgrades the underlying server.”
↩︎ Key concept“Standard mode is available for Lakeflow Jobs and Lakeflow pipelines, but not for notebooks.”
↩︎ Exam trap 1“Standard mode is available for Lakeflow Jobs and Lakeflow pipelines, but not for notebooks.”
↩︎ Prediction - 2.
“ML: A base environment with the Python and system packages from Databricks Runtime for Machine Learning pre-installed.”
↩︎ Environment versions replace runtime versions“Each job task runs in an isolated environment that includes a base environment and any additional libraries you specify.”
↩︎ Environment versions replace runtime versions“Notebook tasks default to Notebook Environment, which uses the notebook's own configured base environment and dependencies.”
↩︎ Environment versions replace runtime versions“You can specify a dependency in any format that is valid in a requirements.txt file.”
↩︎ Declaring and caching dependencies“Databricks resolves and installs dependencies before your notebook or task code runs.”
↩︎ Declaring and caching dependencies“To install from a private or authenticated package repository, specify index-url or extra-index-url in the dependency specification.”
↩︎ Declaring and caching dependencies“any task that shares the same set of dependencies as a completed task in the same run finishes faster”
↩︎ Declaring and caching dependencies“Because serverless does not support compute policies or init scripts, you must install custom dependencies using the Environment side pane.”
↩︎ What serverless will not let you configure“Serverless compute also does not support compute-scoped environment variables, so proxy settings applied at runtime have no effect on dependency installation.”
↩︎ What serverless will not let you configure“High: 32 GB total memory.”
↩︎ High-memory notebook tasks and auto-optimization retries“Serverless usage with high memory has a higher DBU emission rate than standard memory.”
↩︎ High-memory notebook tasks and auto-optimization retries“Updating the memory preference in the notebook affects the next job run.”
↩︎ High-memory notebook tasks and auto-optimization retries“It doesn't affect the memory size of the Spark session.”
↩︎ Exam trap 2“If you change the implementation of a custom Python package used in a job on serverless, you must also update its version number”
↩︎ Exam trap 4“If you change the implementation of a custom Python package used in a job on serverless, you must also update its version number”
↩︎ Checkpoint“increases the size of the REPL memory used when running code in the notebook. It doesn't affect the memory size of the Spark session.”
↩︎ Checkpoint - 3.
“You can set Spark configuration parameters at the session level only.”
↩︎ What serverless will not let you configure“Serverless compute for workflows automatically and continuously optimizes infrastructure, such as instance types, memory, and processing engines”
↩︎ What serverless will not let you configure“Both modes use the same SKU, but standard performance mode consumes fewer DBUs, reflecting lower compute usage.”
↩︎ Performance mode: startup latency against DBU cost“This setting only affects the serverless tasks within the job.”
↩︎ Performance mode: startup latency against DBU cost“High memory is only available for notebook task types.”
↩︎ High-memory notebook tasks and auto-optimization retries“Auto-optimization is enabled by default, and Databricks recommends leaving it enabled to ensure critical workloads run successfully at least once.”
↩︎ High-memory notebook tasks and auto-optimization retries“uncheck Enable serverless auto-optimization (may include additional retries).”
↩︎ High-memory notebook tasks and auto-optimization retries“if you have workloads that must be executed at most once, for example, jobs that are not idempotent, you can turn off auto-optimization”
↩︎ Exam trap 3“if you have workloads that must be executed at most once, for example, jobs that are not idempotent, you can turn off auto-optimization”
↩︎ Checkpoint - 4.
“The performance mode on a serverless job. Supported values: [PERFORMANCE_OPTIMIZED, STANDARD]”
↩︎ Performance mode: startup latency against DBU cost“Because they are not saved, Databricks can't auto-optimize serverless compute in case of failure.”
↩︎ High-memory notebook tasks and auto-optimization retries“do not show up in the UI, and do not retry when they fail.”
↩︎ High-memory notebook tasks and auto-optimization retries