CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 1 · Lesson 10/45

    Serverless compute configuration: environments, performance mode, memory and retries

    Choose appropriate compute and configuration for environments and dependencies — including serverless compute (serverless environments, dependency management, performance mode), high-memory notebook tasks, and auto-optimization settings (e.g., disallowing retries).

    18 min read
    1.92% of exam
    4 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    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.

    Fields of a serverless job environment and its spec in a job definition
    KeyMeaning
    environment_keyKey of the environment; must be unique within a job
    specThe entity that represents a serverless environment
    environment_versionInside spec. Required. Each version comes with a specific Python version and a set of Python packages
    dependenciesInside spec. List of pip dependencies, as supported by the version of pip in this environment
    clientInside 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.

    A notebook on Standard v5 exports its environment version as inline metadatapython
    # 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!")

    Sources12

    2.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.

    A pinned requirements file for serverless workloadstext
    numpy==2.2.2
    pandas==2.2.3

    After 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?

    Sources21

    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?

    Sources231

    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.

    Choosing a serverless performance mode
    AspectPerformance optimizedStandard
    Default?YesNo; disable Performance optimized
    StartupFast, from a pool of warm computeRoughly 4 to 6 minutes
    DBU consumptionHigherLower, up to 70% less; same SKU
    Available forNotebooks, Lakeflow Jobs, Lakeflow pipelinesLakeflow Jobs and Lakeflow pipelines only
    Best fitInteractive and time-sensitive workScheduled batch jobs and pipelines
    API/CLI valuePERFORMANCE_OPTIMIZEDSTANDARD

    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?

    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?

    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?

    Sources134

    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.

    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?

    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?

    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?

    Sources234

    Sources

    (4)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 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. 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
      “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. 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. 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

    Spotted a mistake, or was something unclear? Tell us.