Azure SQL Elastic Pool offers a cost-effective way to manage multiple databases by allowing you to pool them together into a single resource.
This approach reduces costs by up to 75% compared to provisioning separate resources for each database.
By consolidating databases into a single pool, you can simplify database management and improve scalability.
With Azure SQL Elastic Pool, you can easily add or remove databases as needed, making it a flexible solution for changing database requirements.
What is Azure SQL Elastic Pool?
Azure SQL Elastic Pool is a game-changer for organizations with multiple databases and unpredictable workloads. It allows you to manage multiple databases that have varying performance by sharing DTUs amongst themselves.
This means you can assign higher resources during peak usage and lower resources during off-peak times, resulting in better performance and cost savings. In an Elastic pool, multiple databases can share DTUs and storage, giving you more flexibility.
You can allocate a shared set of compute resources to a collection of Azure SQL databases, running them in a shared resource pool on a co-tenanted Azure server. This allows for scalability, but keep in mind that you have no direct control over the server.
A single database can be moved in and out of an elastic pool, giving you flexibility. An elastic pool is a collection of a single database with a shared set of resources, such as CPU or memory.
Here are some scenarios to use an elastic pool with your Hyperscale databases:
- When you need to scale the compute resources allocated to the elastic pool up or down in a predictable amount of time, independent of the amount of allocated storage.
- When you want to scale out the compute resources allocated to the elastic pool by adding one or more read-scale replicas.
- If you want to use high transaction log throughput for write-intensive workloads, even with lower compute resources.
When to Consider Azure SQL Elastic Pool
Azure SQL Elastic Pools can be a game-changer for organizations with multiple databases, especially those with unpredictable workloads. This is because they allow you to manage multiple databases with varying performance, sharing DTUs amongst themselves as needed, resulting in better performance and cost savings.
Pools are well-suited for a large number of databases with specific utilization patterns, characterized by low average utilization with infrequent utilization spikes for a given database. In fact, the more databases you can add to a pool, the greater your savings.
To determine if your databases are good candidates for an elastic pool, consider the following: an S3 Database that peaks to 100 DTUs and an average uses 67 DTUs or less is a good candidate for sharing eDTUs in a pool. Similarly, an S1 database that peaks to 20 DTUs and on average uses 13 DTUs or less is a good candidate for a pool.
Here are some key characteristics of databases that are well-suited for elastic pools:
- Low average utilization (less than 67 DTUs for an S3 database or 13 DTUs for an S1 database)
- Infrequent utilization spikes
- Ability to share DTUs with other databases in the pool
By considering these factors, you can determine whether Azure SQL Elastic Pools are right for your organization and start reaping the benefits of better performance and cost savings.
When to Consider a Database?
Consider a database elastic pool when you have a large number of databases with specific utilization patterns, characterized by low average utilization with infrequent spikes.
This pattern is well-suited for elastic pools, which can help you save by spreading the cost across multiple databases.
In fact, you can see savings with as few as two S3 databases, depending on your application's utilization pattern.
Elastic pools are not ideal for multiple databases with persistent medium-high utilization, so consider this before making a decision.
The more databases you can add to a pool, the greater your savings will be.
The vCore unit price for elastic pools is the same as for single databases in the vCore purchasing model.
Why Use?
Azure SQL Elastic Pools are a game-changer for many organizations, and for good reason. They offer significant cost savings for ISV/SaaS vendors hosting a large number of databases in elastic pools compared to standalone databases.
To understand why elastic pools are beneficial, let's consider an example. Imagine you have two S4 Azure SQL Databases, each with access to a maximum of 200 DTUs. By placing them in a 200eDTU elastic pool, you can allow either database to use all the pool's DTUs at any time, which can be particularly useful for databases with spiky workloads.
In fact, databases with low average utilization and infrequent utilization spikes are well-suited for elastic pools. This pattern is characterized by low average utilization with spikes for a given database.
Elastic pools also perform at the same level as standalone databases, and sometimes even better, thanks to the ability to spike in resource consumption while other databases are idle within the same pool.
So, when is a database a good candidate for an elastic pool? An S3 Database that peaks to 100 DTUs and averages 67 DTUs or less is a good candidate, as is an S1 database that peaks to 20 DTUs and averages 13 DTUs or less.
Here are some key characteristics of databases that are well-suited for elastic pools:
- Low average utilization
- Infrequent utilization spikes
- Spiky workloads
- Low peak usage compared to average usage
By considering these factors and monitoring utilization for both databases and the elastic pool, you can determine whether an elastic pool is right for your organization.
Database Configuration and Management
Database configuration and management in Azure SQL Elastic Pools is a breeze with the right tools. You can create a new database in an existing pool or as a single database using the CREATE DATABASE command.
To manage your databases, you can use the ALTER DATABASE command to move a database into, out of, or between elastic pools. This gives you the flexibility to adjust your database resources as needed.
You can also use the DROP DATABASE command to delete a database. This is especially useful when you no longer need a database or want to free up resources.
Here's a quick rundown of some useful T-SQL commands for managing elastic pools:
To get a better understanding of your elastic pool's resource usage, you can use the sys.elastic_pool_resource_stats and sys.dm_elastic_pool_resource_stats DMVs. These will give you a detailed breakdown of CPU, IO, Log, storage consumption, and concurrent request/session utilization by all databases in the pool.
Database Utilization Patterns
Database utilization patterns can significantly impact your database configuration and management strategy. A pool is a suitable solution for databases with large differences between peak and average utilization.
In an ideal scenario, a database's peak utilization is much higher than its average utilization, and the peak utilization for each database occurs at different points in time. This is the case for DB1, which peaks at 90 DTUs but averages fewer than five DTUs.
A pool allows unused DTUs to be shared across multiple databases, reducing the overall cost. With a pool, you can reduce the number of DTUs needed and the overall cost, making it a cost-effective solution.
The DTU purchasing model takes into account the pool's eDTUs, with a price that's a function of the pool eDTUs. The eDTU unit price for a pool is 1.5 times greater than the DTU unit price for a single database.
In a real-world example, 20 databases with similar utilization patterns as DB1 can share 100 eDTUs, resulting in a 20-time reduction in DTUs and a 13-time price reduction compared to placing each database in S3 compute sizes for single databases.
The following table illustrates the nonoverlapping nature of database utilization over time:
Per-Database Properties
Per-database properties are an optional feature that allows you to modify resource consumption patterns in elastic pools.
To use per-database properties, you need to set them up for each individual database, which can be a bit of a hassle, but it's worth it for the flexibility it provides.
Optional per-database properties can be set to modify resource consumption patterns in elastic pools, which is particularly useful for databases with varying resource needs.
For more information on how to set up and use per-database properties, be sure to check out the resource limits documentation for DTU and vCore elastic pools.
Storage and Database Limits
You can store up to 100 TB of data per single Hyperscale database, and up to 100 TB across all databases in an elastic pool.
The maximum storage size per database varies depending on the service level objective, with Basic, Standard, and Premium tiers offering 2 GB, 1 TB, and 1 TB respectively.
To give you a better idea of the storage limits, here's a table summarizing the maximum storage sizes per database and per pool for each service level objective:
The number of databases you can have in an elastic pool also varies depending on the service level objective, with Basic, Standard, and Premium tiers offering 500, 500, and 100 databases respectively.
In an elastic pool, each database has a maximum eDTU limit, which is 5 eDTUs for Basic, 3000 eDTUs for Standard, and 4000 eDTUs for Premium.
Manage Hyperscale
To manage your Hyperscale databases, you can use the same commands as for pooled databases in other service tiers. Just be sure to specify Hyperscale for the edition when creating your Hyperscale elastic pool.
You can modify the number of high availability (H/A) replicas for an existing Hyperscale elastic pool. To do so, use the HighAvailabilityReplicaCount parameter of the Azure PowerShell Set-AzSqlElasticPool command or the --ha-replicas parameter of the Azure CLI az sql elastic-pool update command.
You can use Azure PowerShell, Azure CLI, or Transact-SQL (T-SQL) to manage your Hyperscale databases in an elastic pool. Azure PowerShell requires Az.Sql.3.11.0 or higher, while Azure CLI requires Az version 2.40.0 or higher. For T-SQL, you'll need SQL Server Management Studio (SSMS) v18.12.1 or Azure Data Studio v1.39.1.
Here are the client tools you can use to manage your Hyperscale databases:
- Azure PowerShell: Az.Sql.3.11.0 or higher
- Azure CLI: Az version 2.40.0 or higher
- Transact-SQL (T-SQL): SQL Server Management Studio (SSMS) v18.12.1 or Azure Data Studio v1.39.1
Convert to Hyperscale
Converting to Hyperscale can be a game-changer for your database, allowing you to scale up or down as needed and take advantage of improved performance and cost savings.
Azure SQL Database Hyperscale elastic pools are generally available, and creating an elastic pool and selecting an existing or new server is straightforward. You can use T-SQL commands to convert multiple General Purpose databases and add them to an existing Hyperscale elastic pool.
To convert non-Hyperscale databases to Hyperscale elastic pools using T-SQL, you'll need to use the ALTER DATABASE command, specifying the target SERVICE_OBJECTIVE as a Hyperscale elastic pool. This will start the conversion process, which returns quickly and doesn't wait for the conversion to complete.
You can monitor the status of these background conversion operations using the sys.dm_operation_status dynamic management view. This view provides real-time information on the conversion status, allowing you to keep track of progress and identify any issues that may arise.
Converting multiple databases at once can be done using a single T-SQL command, making it a quick and efficient process. For example, you can use the following command to convert four General Purpose databases to Hyperscale: ALTER DATABASE [database1] MODIFY (SERVICE_OBJECTIVE = 'hsep1'); ALTER DATABASE [database2] MODIFY (SERVICE_OBJECTIVE = 'hsep1'); ALTER DATABASE [database3] MODIFY (SERVICE_OBJECTIVE = 'hsep1'); ALTER DATABASE [database4] MODIFY (SERVICE_OBJECTIVE = 'hsep1');
Alternatively, you can use PowerShell commands to convert multiple General Purpose databases and add them to an existing Hyperscale elastic pool. This approach allows you to script the conversion process and automate it for multiple databases. The Get-AzSqlDatabaseActivity cmdlet can be used to monitor the status of these background conversion operations, providing real-time information on the conversion status.
Here's a step-by-step guide to converting non-Hyperscale databases to Hyperscale elastic pools using PowerShell:
- Use the Get-AzSqlElasticPoolDatabase cmdlet to list all the databases in the General Purpose elastic pool named gpep1.
- The Where-Object cmdlet filters the list to only those database names starting with gpepdb.
- For each database, Set-AzSqlDatabase cmdlet starts a conversion to the Hyperscale service tier by specifying the target Hyperscale elastic pool named hsep1.
Note that the Hyperscale elastic pool needs to exist on the same logical server as the source database when converting databases to Hyperscale. Additionally, be aware of the maximum number of databases per Hyperscale elastic pool to avoid any potential issues.
Create Database
Creating a new database is a straightforward process, and you can do it in the Azure portal by searching for and selecting Azure SQL.
To create an elastic pool, you have two options: create an elastic pool and select an existing or new server, or create an elastic pool from an existing server.
You can create an elastic pool from an existing server by going to that server and selecting New pool. This will create a pool directly in that server.
You can create multiple pools on a server, but you can't add databases from different servers into the same pool.
The pool's service tier determines the features available to the elastics in the pool, and the maximum amount of resources available to each database.
To configure the resources and pricing of the pool, select Configure pool, then select a service tier, add databases to the pool, and configure the resource limits for the pool and its databases.
You can manage your elastic pool via the Azure portal, PowerShell, Azure CLI, REST API, or T-SQL after creating it.
Sources
- https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-pool-overview
- https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-pool-manage
- https://learn.microsoft.com/en-us/azure/azure-sql/database/hyperscale-elastic-pool-overview
- https://dzone.com/articles/azure-sql-elastic-pool
- https://documentation.solarwinds.com/en/success_center/sam/content/sam-microsoft-azure-sql-server-database-elastic-pool.htm
Featured Images: pexels.com