Optimize price-performance with compute auto-scaling in Azure SQL Database serverless
Published Nov 04 2019 05:00 AM 25.9K Views
Microsoft

Optimizing compute resource allocation to achieve performance goals while controlling costs can be a challenging balance to strike especially for database workloads with complex usage patterns.  To help address these challenges, we are pleased to announce the general availability of Azure SQL Database serverless.  SQL Database serverless optimizes price-performance and simplifies performance management for databases with intermittent and unpredictable usage.  Line-of-business applications, dev/test databases, content management and e-commerce systems are just some examples across a range of applications that often fit the usage pattern ideal for SQL Database serverless.  SQL Database serverless is also well-suited for new applications with compute sizing uncertainty or workloads requiring frequent rescaling in order to reduce costs.  The serverless compute tier enjoys all the fully managed, built-in intelligence benefits of SQL Database and helps accelerate application development, minimize operational complexity, and lower total costs.

 

Compute auto-scaling

SQL Database serverless automatically scales compute for single databases based on workload demand and bills for compute used per second.  Serverless contrasts with the provisioned compute tier in SQL Database which allocates a fixed amount of compute resources for a fixed price and is billed per hour.  Over short time scales, provisioned compute databases must either over-provision resources at a cost in order to accommodate peak usage or under-provision and risk poor performance.  Over longer time scales, provisioned compute databases can be rescaled, but this solution may require predicting usage patterns or writing custom logic to trigger rescaling operations based on a schedule or performance metrics.  This adds to development and operational complexity. In serverless, compute scaling within configurable limits is managed by the service to continuously right-size resources.  Serverless also provides an option to automatically pause the database during inactive usage periods and automatically resume when activity returns.

 

Pay only for compute used

In SQL Database serverless, compute is only billed based on the amount of CPU and memory used per second.  While the database is paused only storage is billed, providing additional price optimization benefit.

 

For example, consider a line-of-business application that is idle at night, but needs multi-core bursting headroom throughout the day.  Suppose the application is using a serverless database configured to allow auto-pausing and auto-scaling up to 16 vcores and has the following usage pattern over a 24 hour period:

 

clipboard_image_0.png

 

As can be seen, database usage corresponds to the amount of compute billed which is measured in units of vcore seconds and sums to around 123k vcore seconds over the 24 hour period.  Suppose the compute unit price for the serverless database is around $0.000145/vcore/second.  Then the compute bill for this one day period is around $18.  This is calculated by multiplying the compute unit price by the total number of vcore seconds accumulated.  During this time period, the database was auto-paused while idle and enjoyed the benefit of bursting episodes up to 100 percent of 16 vcores without customer intervention.  In this example, the price savings using serverless is significant compared to a provisioned compute database configured with the same 16 vcore limit.

  

In this example, pricing is based on the East US region starting January 2020 and subject to change.  For the most up-to-date pricing, please visit the Azure SQL Database pricing page.

 

Price-performance trade-offs

When using SQL Database serverless there are price-performance trade-offs to consider.  These trade-offs are related to the compute unit price and the impact on application performance due to compute warm-up after periods of low or idle usage.

 

Compute unit price

The compute unit price is higher for a serverless database than for a provisioned compute database since serverless is optimized for workloads with intermittent usage patterns.  If CPU or memory usage is high enough and sustained for long enough, then the provisioned compute tier may be less expensive.

 

Compute warm-up after low usage

While a serverless database is online, memory is gradually reclaimed if CPU or memory usage is low enough for long enough.  When workload activity returns, disk IO may be required to rehydrate data pages into the SQL buffer pool or query plans may need to be recompiled.  This memory management policy to reclaim cache based on low usage is unique to SQL Database serverless and done to control customer costs, but can impact performance.  Memory reclamation based on low usage does not occur in the provisioned compute tier for single databases or elastic pools where this kind of impact can be avoided.

 

Compute warm-up after pausing

The latency to pause and resume a serverless database is usually around one minute or less during which time the database is offline.  After the database is resumed, memory caches need to be rehydrated which adds additional latency before optimal performance conditions return.  The idle period that must elapse before auto-pausing occurs can be configured to compensate for this performance impact.  Alternatively, auto-pausing can be disabled for workloads sensitive to this impact and still benefit from auto-scaling.  Compute minimums are billed while the database is online regardless of usage, and so disabling auto-pausing can increase costs.

 

Learn more

Azure SQL Database serverless is supported in the General Purpose tier for single databases.

 

4 Comments
Copper Contributor

@Morgan_Oslake I love the concept of serverless, especially the ability for the database to be disabled and only billed for Storage. 


Unfortunately, the cost hasn't worked out that way.  As a test, I deployed a serverless blank DB (.5 vCPU min, 2vCPU max) with auto-disable after 1hr.  No activity on it.  The cost on the database was ~$130 in Oct and in Sept. 

Microsoft

Outside of storage related costs, it sounds like the database may not have auto-paused for some reason.  Note that auto-pausing is prevented if certain functionality is enabled such as LTR or geo-replication.  Specific conditions that prevent pausing are documented here: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-serverless#autopausing-and-autoresu... Will follow up regarding your specific case.

Copper Contributor

Thanks for the response.  I've spun up some more DBs to test, and the pause feature is working as it should.

 

LTR isn't intuitive that it would prevent the pause feature.  I'll keep this in mind. 

Copper Contributor

Yes, unfortunately the lack of LTR support with pause makes this a difficult proposition for us.

Version history
Last update:
‎Nov 04 2019 04:14 PM
Updated by: