Serverless compute and environments
Databricks Data Engineer Professional · Lesson 1 of 21 · 4:03
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Data Engineer Professional exam. In this lesson: serverless compute instead of clusters sized by hand, the performance optimized and standard performance modes, memory and automatic retries, serverless environments and their dependencies, and troubleshooting library installs. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Clusters sized by hand
Quayside Eats runs its nightly order jobs on classic clusters that an engineer sized by hand, and last week, a library upgrade broke the scoring task. The team is moving its jobs, notebooks, and pipelines to serverless compute, and must choose the right mode, memory, and dependencies for each workload. This lesson covers serverless compute for jobs, serverless environments, and how to troubleshoot library installs.
Performance modes
Databricks recommends serverless compute for job tasks: it manages the infrastructure, autoscaling and Photon are automatic, and the runtime stays up to date. Serverless jobs offer two performance modes. Performance optimized mode, the default, starts quickly and runs quickly, for interactive and time sensitive workloads. Standard mode uses fewer DBUs, so it costs less, but a run usually takes about four to six minutes to start, which suits scheduled batch jobs. You choose the mode in the compute settings of the job, and it does not apply to interactive notebooks.
Memory and retries
Some tasks run out of memory on serverless. A serverless notebook gets sixteen gigabytes of memory by default, and high memory raises it to thirty two, from the Memory setting of the Environment panel. High memory applies to the notebook's own memory, not to the Spark session, it uses more DBUs, and in jobs it is only available for notebook tasks. Serverless jobs also apply auto-optimization: Databricks tunes the compute and retries failed tasks, and this is on by default. For a task that is not idempotent, like one that sends emails or appends rows, turn auto-optimization off in the retry policy of the task, so that it never runs twice.
Environments
Serverless compute has no init scripts and no compute policies, so dependencies go in an environment. In a notebook, the Environment panel picks a base environment, like Standard or ML, and lists extra dependencies in the format of a requirements file: PyPI packages, or wheels and projects stored in workspace files or in a volume. In a job, Python script and wheel tasks need an environment, and a bundle declares it under environments, with an environment key that each task references. Databricks caches the virtual environment, so packages are not reinstalled at every run. Notebooks and files in a Git folder or a bundle can also share one environment, defined in a pyproject.toml file at the root.
Troubleshooting installs
When an install fails, start with the pip logs in the Environment panel, and the error of the task. A version conflict usually means that two packages need different versions of the same library, so pin exact versions that you have tested together, and never install PySpark, which would stop the Spark session. Serverless may run on Arm or on x86 machines, so prefer pure Python wheels, or provide one wheel per architecture. Packages from a private repository need an index URL in the dependencies, or a default repository set by a workspace admin. In a Lakeflow pipeline, dependencies go in the environment settings of the pipeline, and serverless pipelines cannot use init scripts or JVM libraries. And a source archive, like a tar file, is built at install time, so a wheel, built once by the bundle, installs faster and more predictably.
Recap
Let's recap. Serverless jobs run in performance optimized mode by default, while standard mode starts slower and costs less, for scheduled batch work. High memory doubles the notebook's memory for more DBUs, and auto-optimization retries failed tasks unless you turn it off for a task that is not idempotent. Dependencies go in an environment, with a base environment and a list of PyPI packages, wheels, or projects, referenced by each task in a bundle. When an install fails, read the pip logs, pin tested versions, never install PySpark, and prefer pure Python wheels. And pipelines take their dependencies from their environment settings, without init scripts or JVM libraries.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A nightly batch job aggregates the day’s orders for a report that nobody reads before 9 a.m., and finance wants to cut its serverless cost. What should the data engineer change?
- Turn on high memory for the tasks
- Turn off performance optimized mode
- Add a retry policy with three retries
- Move the job to an all-purpose cluster
Show the answer
Turn off performance optimized mode
Standard mode uses fewer DBUs, and a slower start does not matter for a nightly report. “Turn on high memory for the tasks” would raise the cost, since high memory uses more DBUs. “Add a retry policy with three retries” only reruns failed tasks, and does not lower the cost of a normal run. And “Move the job to an all-purpose cluster” would move a scheduled job to interactive compute, which costs more and is not managed for you.
A bundle defines a serverless job whose Python wheel task imports geopy. The deployment succeeds, but the task fails because the module is not found. What should the data engineer add?
- An init script that installs geopy with pip
- A compute policy that lists geopy
- geopy in the libraries of an all-purpose cluster
- An environment listing geopy, set on the task
Show the answer
An environment listing geopy, set on the task
On serverless, a task gets its libraries from an environment, which lists geopy, and which the task references by its environment key. “An init script that installs geopy with pip” is not possible, since serverless compute does not run init scripts. “A compute policy that lists geopy” is not possible either, since serverless compute does not use compute policies. And “geopy in the libraries of an all-purpose cluster” would install the package on another compute, which the serverless task never uses.
A serverless job installs a compiled wheel that the team built on an x86 laptop, and the install fails on some runs, but not on others. What is the most likely fix?
- A pure Python wheel, or one per architecture
- Pin the version of the wheel
- Install PySpark in the same environment
- Turn off auto-optimization for the task
Show the answer
A pure Python wheel, or one per architecture
Serverless may run on Arm or on x86 machines, so a compiled wheel only installs on one of them, while a pure Python wheel, or one wheel per architecture, works on both. “Pin the version of the wheel” would keep the same wheel, which still fails on the other architecture. “Install PySpark in the same environment” would stop the Spark session, since PySpark must never be installed on serverless. And “Turn off auto-optimization for the task” only controls retries, and the install would still fail on the other machines.