Sub topic 9
Understanding cost: DBUs plus cloud infrastructure
This chapter assumes you know what all-purpose, job, and serverless compute are, and that you can read a cluster definition in JSON. It explains how a compute bill is built, so you can compare options before you pick one.
Two meters on classic compute
Classic compute (all-purpose and job clusters) runs in your own cloud account. You pay two separate charges for it:
- Databricks charge. Databricks bills in DBUs. A Databricks Unit (DBU) is a unit of processing capability per hour. Each instance type consumes a set number of DBUs per hour. The price per DBU depends on the compute type, your plan, and your cloud.
- Cloud infrastructure charge. Your cloud provider bills you directly for the virtual machines, attached storage, and network traffic. Databricks does not collect this charge.
The Databricks charge for one hour is:
DBUs per node per hour × number of nodes × price per DBU
The driver counts as a node. The infrastructure charge for the same hour is the VM price per node times the number of nodes, plus storage and network costs.
Why compute type changes the DBU price
The same VM costs a different amount per DBU depending on how you run it. All-purpose compute has a higher DBU price than job compute. The reason is that all-purpose clusters are meant for interactive work. Job clusters run automated work and exist only while the run lasts.
Running a scheduled pipeline on an all-purpose cluster therefore costs more than running it on a job cluster. It can also cost more in idle time, because the cluster stays up after the work ends until auto termination fires.
A worked estimate
Suppose a cluster has one driver and four workers. Each node uses 1 DBU per hour. The DBU price is $0.15 for job compute and $0.55 for all-purpose compute. The VM costs $0.30 per hour. These prices are made up for the example. Check your own rate card.
| Item | Job cluster, 2 hours | All-purpose cluster, 2 hours |
|---|---|---|
| Nodes | 5 | 5 |
| DBU charge | 5 × 1 × 2 × $0.15 = $1.50 | 5 × 1 × 2 × $0.55 = $5.50 |
| VM charge | 5 × 2 × $0.30 = $3.00 | 5 × 2 × $0.30 = $3.00 |
| Total | $4.50 | $8.50 |
The VM charge is the same. The DBU price accounts for the whole difference.
What changes with serverless
Serverless compute is run by Databricks in Databricks' own cloud account, not yours. You receive one bill, in DBUs, and no separate VM charge from your cloud provider. The DBU rate is higher than for classic compute because it includes the infrastructure.
In exchange, you do not pay for idle VMs that you forgot about, and you do not wait for nodes to start. You also have fewer settings to tune, because there is no node type or worker count to choose.
Common cost mistakes
- Running scheduled work on all-purpose clusters. You pay the higher DBU rate for work that needs no interactive features.
- Counting only DBUs. The cloud bill for the same cluster can be as large as the Databricks bill. Compare both.
- Forgetting idle time. Classic clusters bill from start until termination. Set
autotermination_minutes, as in the earlier all-purpose example. - Comparing hourly rates only. A serverless job that finishes sooner, with no start wait, can cost less overall even at a higher rate. Compare the cost per run, not per hour.
- Ignoring the driver. The driver bills at the same node rate as a worker, so a one-worker cluster has two billed nodes.
Where to see the numbers
Use the account console usage page and the billing system tables to see DBU consumption by cluster, job, and tag. Add custom tags to clusters so cloud invoices can also be split by team. Cluster policies, covered next, can require those tags.
Exercise
A job cluster has one driver and three workers, each at 2 DBUs per hour. The job DBU price is $0.20, and each VM costs $0.40 per hour. The job runs for 3 hours. What is the total cost, counting DBUs and VMs?
Show answer
There are 4 nodes. DBU charge: 4 × 2 × 3 × $0.20 = $4.80. VM charge: 4 × 3 × $0.40 = $4.80. Total: $9.60.
Exercise
Why can a serverless job cost less than the same job on a classic job cluster, even though the serverless DBU rate is higher?
Show answer
Serverless has no node start wait and no idle VMs, and the rate includes infrastructure. If the run finishes sooner and bills only for the work done, the cost per run can be lower, so compare per run and not per hour.