Azure SQL Database Serverless

Azure SQL Database serverless is a compute tier for single databases that automatically scales compute based on workload demand and pauses databases when they are not in use. The serverless compute tier is built for workloads with intermittent, unpredictable usage patterns, and small, isolated databases that need to be automatically paused and resumed. This tier is ideal for a cost-effective solution for managing databases with a lighter, spiky workload.

Key Benefits

  • Automatic Scaling: Compute scales up and down based on workload demand.
  • Automatic Pausing: Databases automatically pause when not in use, saving costs.
  • Cost-Effective: Pay only for what you use, making it ideal for variable workloads.
  • Rapid Resumption: Databases can resume quickly when a new workload arrives.

Understanding Serverless

The serverless compute tier is designed to handle the most cost-sensitive, sporadic workloads. It offers a unique set of features that distinguish it from provisioned compute tiers.

How it Works

When a database in the serverless tier experiences no activity for a configurable period, it automatically enters a dormant state. During this state, compute costs are eliminated. When a new activity occurs, the database automatically resumes and scales its compute resources to handle the incoming workload. This dynamic behavior ensures that you are not paying for idle compute resources, which is a significant advantage for many scenarios.

Key Concepts

  • vCore: The unit of compute for the serverless tier.
  • Compute Min/Max: You define the minimum and maximum vCore values for scaling.
  • Auto-pause delay: The duration of inactivity before the database is paused.
  • Auto-resume: The process of the database resuming from a paused state.

Developer Tip:

When developing applications that utilize Azure SQL Database serverless, consider implementing retry logic for connection attempts, as there might be a slight delay when a database resumes from a paused state.

Use Cases

Azure SQL Database serverless is an excellent choice for:

  • New applications with unknown or spiky usage patterns.
  • Small databases that are used infrequently.
  • Development and test environments.
  • Databases that require automatic cost savings during idle periods.

Configuration and Management

Configuring Azure SQL Database serverless involves defining the minimum and maximum compute size (in vCores) and the auto-pause delay. These settings can be managed through the Azure portal, Azure CLI, PowerShell, or ARM templates.

Setting Compute Limits

The GeneralPurpose-Serverless compute tier allows you to set a range for vCores. For instance, you might set a minimum of 0.5 vCores and a maximum of 4 vCores. The service will scale within this range based on demand.

Auto-Pause Delay

The auto-pause delay can be set from 1 hour up to 7 days. If the database remains inactive for the duration of the auto-pause delay, it will be paused.

Pricing

Pricing for Azure SQL Database serverless is based on a combination of compute usage (vCore-hours) and storage. You are charged for compute usage while the database is active and for storage regardless of its state. When the database is paused, compute costs are eliminated.

Related Topics