5 Classes Discovered from Testing Databricks SQL Serverless + DBT | by Jeff Chou | Oct, 2023

We ran a $12K experiment to check the associated fee and efficiency of Serverless warehouses and dbt concurrent threads, and obtained sudden outcomes.

By: Jeff Chou, Stewart Bryson

Picture by Los Muertos Crew

Databricks’ SQL warehouse merchandise are a compelling providing for corporations seeking to streamline their manufacturing SQL queries and warehouses. Nonetheless, as utilization scales up, the associated fee and efficiency of those programs turn into essential to investigate.

On this weblog we take a technical deep dive into the associated fee and efficiency of their serverless SQL warehouse product by using the trade normal TPC-DI benchmark. We hope knowledge engineers and knowledge platform managers can use the outcomes offered right here to make higher selections in terms of their knowledge infrastructure decisions.

Earlier than we dive into a selected product, let’s take a step again and have a look at the totally different choices out there immediately. Databricks presently provides 3 different warehouse options:

  • SQL Basic — Most elementary warehouse, runs inside buyer’s cloud atmosphere
  • SQL Professional — Improved efficiency and good for exploratory knowledge science, runs inside buyer’s cloud atmosphere
  • SQL Serverless — “Finest” efficiency, and the compute is totally managed by Databricks.

From a price perspective, each basic and professional run contained in the consumer’s cloud atmosphere. What this implies is you’re going to get 2 payments to your databricks utilization — one is your pure Databricks value (DBU’s) and the opposite is out of your cloud supplier (e.g. AWS EC2 invoice).

To essentially perceive the associated fee comparability, let’s simply have a look at an instance value breakdown of operating on a Small warehouse primarily based on their reported instance types:

Value comparability of jobs compute, and the assorted SQL serverless choices. Costs proven are primarily based on on-demand listing costs. Spot prices will vary and have been chosen primarily based on the costs on the time of this publication. Picture by creator.

Within the desk above, we have a look at the associated fee comparability of on-demand vs. spot prices as nicely. You possibly can see from the desk that the serverless possibility has no cloud element, as a result of it’s all managed by Databricks.

Serverless may very well be value efficient in comparison with professional, should you have been utilizing all on-demand cases. But when there are low cost spot nodes out there, then Professional could also be cheaper. General, the pricing for serverless is fairly cheap in my view because it additionally consists of the cloud prices, though it’s nonetheless a “premium” value.

We additionally included the equal jobs compute cluster, which is the most affordable possibility throughout the board. If value is a priority to you, you possibly can run SQL queries in jobs compute as nicely!

The Databricks serverless possibility is a completely managed compute platform. That is just about similar to how Snowflake runs, the place all the compute particulars are hidden from customers. At a excessive stage there are execs and cons to this:


  • You don’t have to consider cases or configurations
  • Spin up time is far lower than beginning up a cluster from scratch (5–10 seconds from our observations)


  • Enterprises might have safety points with all the compute operating inside Databricks
  • Enterprises might not have the ability to leverage their cloud contracts which can have particular reductions on particular cases
  • No means to optimize the cluster, so that you don’t know if the cases and configurations picked by Databricks are literally good to your job
  • The compute is a black field — customers do not know what’s going on or what modifications Databricks is implementing beneath the hood which can make stability a difficulty.

Due to the inherent black field nature of serverless, we have been curious to discover the assorted tunable parameters folks do nonetheless have and their influence on efficiency. So let’s drive into what we explored:

We tried to take a “sensible” strategy to this examine, and simulate what an actual firm may do once they need to run a SQL warehouse. Since DBT is such a preferred software within the fashionable knowledge stack, we determined to take a look at 2 parameters to comb and consider:

  • Warehouse measurement — [‘2X-Small’, ‘X-Small’, ‘Small’, ‘Medium’, ‘Large’, ‘X-Large’, ‘2X-Large’, ‘3X-Large’, ‘4X-Large’]
  • DBT Threads — [‘4’, ‘8’, ‘16’, ‘24’, ‘32’, ‘40’, ‘48’]

The explanation why we picked these two is they’re each “common” tuning parameters for any workload, they usually each influence the compute facet of the job. DBT threads specifically successfully tune the parallelism of your job because it runs by way of your DAG.

The workload we chosen is the favored TPC-DI benchmark, with a scale issue of 1000. This workload specifically is attention-grabbing as a result of it’s really a complete pipeline which mimics extra real-world knowledge workloads. For instance, a screenshot of our DBT DAG is beneath, as you possibly can see it’s fairly sophisticated and altering the variety of DBT threads may have an effect right here.

DBT DAG from our TPC-DI Benchmark, Picture by creator

As a facet be aware, Databricks has a fantastic open source repo that can assist shortly arrange the TPC-DI benchmark inside Databricks solely. (We didn’t use this since we’re operating with DBT).

To get into the weeds of how we ran the experiment, we used Databricks Workflows with a Activity Kind of dbt because the “runner” for the dbt CLI, and all the roles have been executed concurrently; there must be no variance attributable to unknown environmental situations on the Databricks facet.

Every job spun up a brand new SQL warehouse and tore it down afterwards, and ran in distinctive schemas in the identical Unity Catalog. We used the Elementary dbt package to gather the execution outcomes and ran a Python pocket book on the finish of every run to gather these metrics right into a centralized schema.

Prices have been extracted by way of Databricks System Tables, particularly these for Billable Utilization.

Do this experiment your self and clone the Github repo here

Beneath are the associated fee and runtime vs. warehouse measurement graphs. We are able to see beneath that the runtime stops scaling if you get the medium sized warehouses. Something bigger than a medium just about had no influence on runtime (or maybe have been worse). This can be a typical scaling pattern which reveals that scaling cluster measurement just isn’t infinite, they all the time have some level at which including extra compute offers diminishing returns.

For the CS fans on the market, that is simply the elemental CS principal — Amdahls Law.

One uncommon statement is that the medium warehouse outperformed the following 3 sizes up (massive to 2xlarge). We repeated this specific knowledge level just a few instances, and obtained constant outcomes so it isn’t a wierd fluke. Due to the black field nature of serverless, we sadly don’t know what’s happening below the hood and are unable to offer an evidence.

Runtime in Minutes throughout Warehouse Sizes. Picture by creator

As a result of scaling stops at medium, we are able to see in the associated fee graph beneath that the prices begin to skyrocket after the medium warehouse measurement, as a result of nicely mainly you’re throwing dearer machines whereas the runtime stays fixed. So, you’re paying for further horsepower with zero profit.

Value in $ throughout Warehouse Sizes. Picture by creator

The graph beneath reveals the relative change in runtime as we alter the variety of threads and warehouse measurement. For values higher than the zero horizontal line, the runtime elevated (a foul factor).

The % Change in Runtime as Threads Enhance. Picture by creator

The information here’s a bit noisy, however there are some attention-grabbing insights primarily based on the scale of the warehouse:

  • 2x-small — Rising the variety of threads normally made the job run longer.
  • X-small to massive — Rising the variety of threads normally helped make the job run about 10% quicker, though the positive aspects have been fairly flat so persevering with to extend thread rely had no worth.
  • 2x-large — There was an precise optimum variety of threads, which was 24, as seen within the clear parabolic line
  • 3x-large — had a really uncommon spike in runtime with a thread rely of 8, why? No clue.

To place all the pieces collectively into one complete plot, we are able to see the plot beneath which plots the associated fee vs. period of the entire job. The totally different colours symbolize the totally different warehouse sizes, and the scale of the bubbles are the variety of DBT threads.

Value vs period of the roles. Measurement of the bubbles represents the variety of threads. Picture by creator

Within the plot above we see the standard pattern that bigger warehouses usually result in shorter durations however larger prices. Nonetheless, we do spot just a few uncommon factors:

  • Medium is the perfect — From a pure value and runtime perspective, medium is the perfect warehouse to decide on
  • Impression of DBT threads — For the smaller warehouses, altering the variety of threads appeared to have modified the period by about +/- 10%, however not the associated fee a lot. For bigger warehouses, the variety of threads impacted each value and runtime fairly considerably.

In abstract, our prime 5 classes discovered about Databricks SQL serverless + DBT merchandise are:

  1. Guidelines of thumbs are unhealthy — We can’t merely depend on “guidelines of thumb” about warehouse measurement or the variety of dbt threads. Some anticipated traits do exist, however they don’t seem to be constant or predictable and it’s solely dependent in your workload and knowledge.
  2. Enormous variance — For the very same workloads the prices ranged from $5 — $45, and runtimes from 2 minutes to 90 minutes, all attributable to totally different mixtures of variety of threads and warehouse measurement.
  3. Serverless scaling has limits — Serverless warehouses don’t scale infinitely and finally bigger warehouses will stop to offer any speedup and solely find yourself inflicting elevated prices with no profit.
  4. Medium is nice ?— We discovered the Medium Serverless SQL Warehouse outperformed most of the bigger warehouse sizes on each value and job period for the TPC-DI benchmark. We now have no clue why.
  5. Jobs clusters could also be most cost-effective — If prices are a priority, switching to simply normal jobs compute with notebooks could also be considerably cheaper

The outcomes reported right here reveal that the efficiency of black field “serverless” programs can lead to some uncommon anomalies. Because it’s all behind Databrick’s partitions, we do not know what is occurring. Maybe it’s all operating on large Spark on Kubernetes clusters, possibly they’ve particular offers with Amazon on sure cases? Both manner, the unpredictable nature makes controlling value and efficiency difficult.

As a result of every workload is exclusive throughout so many dimensions, we are able to’t depend on “guidelines of thumb”, or pricey experiments which can be solely true for a workload in its present state. The extra chaotic nature of serverless system does beg the query if these programs want a closed loop control system to maintain them at bay?

As an introspective be aware — the enterprise mannequin of serverless is actually compelling. Assuming Databricks is a rational enterprise and doesn’t need to lower their income, they usually need to decrease their prices, one should ask the query: “Is Databricks incentivized to enhance the compute below the hood?”

The issue is that this — in the event that they make serverless 2x quicker, then abruptly their income from serverless drops by 50% — that’s a really unhealthy day for Databricks. If they might make it 2x quicker, after which enhance the DBU prices by 2x to counteract the speedup, then they’d stay income impartial (that is what they did for Photon really).

So Databricks is absolutely incentivized to lower their inner prices whereas preserving buyer runtimes about the identical. Whereas that is nice for Databricks, it’s troublesome to cross on any serverless acceleration know-how to the consumer that ends in a price discount.

Focused on studying extra about the right way to enhance your Databricks pipelines? Attain out to Jeff Chou and the remainder of the Sync Team.

Leave a Reply

Your email address will not be published. Required fields are marked *