Azure SQL Serverless Auto Scale

I recently wrote about Azure SQL Database’s new serverless tier. I explored how to get started with serverless by covering the basics of how vCores are allocated and how much memory and storage is allowed based on vCores. What I didn’t dive deep into is how the auto scaling and billing works, so I’ll do that now.

The cost for a serverless database is the summation of compute cost and storage cost. Storage cost is determined just like it is for the provisioned compute tier, however compute usage is based on your settings and usage. For example, if your compute usage is between the min and max limits you’ve configured, compute is based on the vCore and memory used. If your usage is below the min limit you’ve configured, cost is based on the min vCores and min memory you’ve selected. (consider this your base cost). If you’ve enabled autopause, then compute is zero and only storage costs are incurred while the database is paused. This is what makes the serverless tier very appealing for workloads with prolonged inactive periods, systems with low compute usage, or enterprise workloads during business hours.

I configured a serverless database with a min .75 vCore and max of 6 vCore in the East US region. My vCore-second compute cost was $.000145. To avoid duplicating compute cost formulas that may get updated, I’ll refer you to the official document. The key takeaway is to know that both memory and CPU usage has a formula to calculate vCore seconds for billing.

For this exercise I created a few tables and inserted millions of rows. I then opened a few SSMS windows and did large selects to generate workload. I wanted to see how serverless would handle small request for data nd then much larger request.

Fortunately you can see App CPU billed in the Azure Portal. From the main dashboard, I see the aggregate in a 5 minute interval. On the left is my compute utilization with App CPU billed on the right.

If I click on the App CPU billed metric, I can drill down to per minute with the default 1 hour view. Using the image below we can see that I’ve used 10.88k of vCore seconds. With a cost of $.000145 per vCore second, I just used approx $1.58 USD for the previous hour of compute.

What impresses me so much about the serverless tier is how this can save organizations a tremendous amount of money. As you can see from the graphs, when my workload increased so did my spend, however when the workload decreased, my spend did as well.

Check out my video walk through where I demonstrate auto scaling and how to view App CPU billed.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.