Manage compute in Azure Synapse Analytics data warehouse
Learn about managing compute resources in Azure Synapse Analytics SQL pool. Lower costs by pausing the SQL pool, or scale the data warehouse to meet performance demands.
What is compute management?
The architecture of data warehouse separates storage and compute, allowing each to scale independently. As a result, you can scale compute to meet performance demands independent of data storage. You can also pause and resume compute resources. A natural consequence of this architecture is that billing for compute and storage is separate. If you don't need to use your data warehouse for a while, you can save compute costs by pausing compute.
You can scale out or scale back compute by adjusting the data warehouse units setting for your SQL pool. Loading and query performance can increase linearly as you add more data warehouse units.
To perform a scale operation, SQL pool first kills all incoming queries and then rolls back transactions to ensure a consistent state. Scaling only occurs once the transaction rollback is complete. For a scale operation, the system detaches the storage layer from the compute nodes, adds compute nodes, and then reattaches the storage layer to the Compute layer. Each SQL pool is stored as 60 distributions, which are evenly distributed to the compute nodes. Adding more compute nodes adds more compute power. As the number of compute nodes increases, the number of distributions per compute node decreases, providing more compute power for your queries. Likewise, decreasing data warehouse units reduces the number of compute nodes, which reduces the compute resources for queries.
The following table shows how the number of distributions per Compute node changes as the data warehouse units change. DW30000c provides 60 Compute nodes and achieves much higher query performance than DW100c.
|Data warehouse units||# of compute nodes||# of distributions per node|
Finding the right size of data warehouse units
To see the performance benefits of scaling out, especially for larger data warehouse units, you want to use at least a 1-TB data set. To find the best number of data warehouse units for your SQL pool, try scaling up and down. Run a few queries with different numbers of data warehouse units after loading your data. Since scaling is quick, you can try various performance levels in an hour or less.
Recommendations for finding the best number of data warehouse units:
- For a SQL pool in development, begin by selecting a smaller number of data warehouse units. A good starting point is DW400c or DW200c.
- Monitor your application performance, observing the number of data warehouse units selected compared to the performance you observe.
- Assume a linear scale, and determine how much you need to increase or decrease the data warehouse units.
- Continue making adjustments until you reach an optimum performance level for your business requirements.
When to scale out
Scaling out data warehouse units impacts these aspects of performance:
- Linearly improves performance of the system for scans, aggregations, and CTAS statements.
- Increases the number of readers and writers for loading data.
- Maximum number of concurrent queries and concurrency slots.
Recommendations for when to scale out data warehouse units:
- Before you perform a heavy data loading or transformation operation, scale out to make the data available more quickly.
- During peak business hours, scale out to accommodate larger numbers of concurrent queries.
What if scaling out does not improve performance?
Adding data warehouse units increasing the parallelism. If the work is evenly split between the Compute nodes, the additional parallelism improves query performance. If scaling out is not changing your performance, there are some reasons why this might happen. Your data might be skewed across the distributions, or queries might be introducing a large amount of data movement. To investigate query performance issues, see Performance troubleshooting.
Pausing and resuming compute
Pausing compute causes the storage layer to detach from the Compute nodes. The compute resources are released from your account. You are not charged for compute while compute is paused. Resuming compute reattaches storage to the Compute nodes, and resumes charges for Compute. When you pause a SQL pool:
- Compute and memory resources are returned to the pool of available resources in the data center
- Data warehouse unit costs are zero for the duration of the pause.
- Data storage is not affected and your data stays intact.
- All running or queued operations are cancelled.
When you resume a SQL pool:
- The SQL pool acquires compute and memory resources for your data warehouse units setting.
- Compute charges for your data warehouse units resume.
- Your data becomes available.
- After the SQL pool is online, you need to restart your workload queries.
If you always want your SQL pool accessible, consider scaling it down to the smallest size rather than pausing.
Drain transactions before pausing or scaling
We recommend allowing existing transactions to finish before you initiate a pause or scale operation.
When you pause or scale your SQL pool, behind the scenes your queries are canceled when you initiate the pause or scale request. Canceling a simple SELECT query is a quick operation and has almost no impact to the time it takes to pause or scale your instance. However, transactional queries, which modify your data or the structure of the data, may not be able to stop quickly. Transactional queries, by definition, must either complete in their entirety or rollback their changes. Rolling back the work completed by a transactional query can take as long, or even longer, than the original change the query was applying. For example, if you cancel a query which was deleting rows and has already been running for an hour, it could take the system an hour to insert back the rows which were deleted. If you run pause or scaling while transactions are in flight, your pause or scaling may seem to take a long time because pausing and scaling has to wait for the rollback to complete before it can proceed.
Automating compute management
To automate the compute management operations, see Manage compute with Azure functions.
Each of the scale-out, pause, and resume operations can take several minutes to complete. If you are scaling, pausing, or resuming automatically, we recommend implementing logic to ensure that certain operations have completed before proceeding with another action. Checking the SQL pool state through various endpoints allows you to correctly implement automation of such operations.
See the how to guide for manage compute Another aspect of managing compute resources is allocating different compute resources for individual queries. For more information, see Resource classes for workload management.