Monitor SQL Server Performance on Azure Local
In this article
Monitoring SQL Server performance on Azure Local (formerly Azure Stack HCI) is essential for keeping your databases responsive and avoiding unexpected outages. This guide walks you through the key metrics to watch, the built-in tools to use, and the steps to set up a practical monitoring routine. You'll learn how to track CPU, memory, disk I/O, and query performance, and how to act on the data you collect.
What You'll Need
- Access to the Azure Local cluster (Azure Stack HCI) where SQL Server is deployed.
- Permissions to run SQL Server Management Studio (SSMS) or Azure Data Studio.
- Administrator rights on the Windows Server hosts to configure Performance Monitor or Log Analytics.
- An Azure subscription if you plan to use Azure Monitor for advanced alerting.
Step-by-Step
- Start with SQL Server's built-in reports. Open SSMS, connect to your SQL Server instance, right-click the server name in Object Explorer, choose Reports > Standard Reports, and select Performance – Top Queries by CPU or Disk Usage. These give an immediate snapshot of what's consuming resources.
- Check the core wait statistics. Run this query to see what SQL Server is waiting on most:
SELECT wait_type, wait_time_ms, signal_wait_time_ms, waiting_tasks_count FROM sys.dm_os_wait_stats ORDER BY wait_time_ms DESC;
HighPAGEIOLATCHwaits indicate disk bottlenecks;LCKwaits point to blocking;CXCONSUMERsuggests parallelism issues. - Monitor CPU usage. In Performance Monitor (perfmon) on the host, add counters:
Processor Information\% Processor Timefor the whole system andSQL Server:Buffer Manager\Buffer Cache Hit Ratio. If the cache hit ratio stays above 95%, memory is likely adequate. - Track memory pressure. Query
sys.dm_os_performance_countersforTarget Server Memory (KB)andTotal Server Memory (KB). If Total is consistently close to Target, SQL Server wants more memory. Also watchPage Life Expectancy; values below 300 seconds often mean memory pressure. - Measure disk latency. In perfmon, add
PhysicalDisk\Avg. Disk sec/ReadandAvg. Disk sec/Write. For SQL Server data files, sustained values above 20 ms for reads or writes are a red flag. On Azure Local, also check Storage Spaces Direct health via Windows Admin Center. - Identify blocking queries. Run
sp_who2or use the Activity Monitor in SSMS. Look for sessions with aBLKvalue. To dig deeper, usesys.dm_exec_requestsandsys.dm_exec_sql_textto see the blocking query text. - Set up Azure Monitor (optional but recommended). In the Azure portal, navigate to your Azure Local resource, enable Azure Monitor for VMs, and install the SQL Server monitoring solution. This gives you pre-built dashboards for database health, wait stats, and deadlocks.
- Create custom alerts. In Azure Monitor, set alerts for metrics like CPU > 85% for 10 minutes, disk latency > 20 ms, or SQL Server errors. Use Log Analytics queries to trigger on specific events, such as deadlocks or severe errors.
- Schedule a regular review. Set aside 30 minutes weekly to review the collected data. Look at trends, not just spikes. Compare this week's wait stats to last week's to spot gradual degradation.
Common Mistakes
- Ignoring the host-level metrics. SQL Server performance is tied to the physical host. If the host's CPU or memory is saturated, SQL Server will suffer even if its own counters look fine.
- Focusing only on CPU. Many performance issues are I/O or memory related. Always check wait stats first to see where the bottleneck actually is.
- Using default thresholds blindly. A 20 ms disk latency threshold is a guideline. Some workloads (like OLTP) may need lower, while others (like reporting) can tolerate higher. Establish a baseline for your environment.
- Forgetting to monitor tempdb. Tempdb contention can cause severe slowdowns. Watch
tempdbdata file sizes and wait typePAGELATCH. - Not setting up alerts. Reactive monitoring is better than none, but proactive alerts let you fix issues before users notice.
Tips
- Use the Query Store in SQL Server. It captures query performance history, making it easy to spot regressions after changes.
- On Azure Local, take advantage of Storage Spaces Direct. Check the health of the storage pool regularly via Windows Admin Center – a degraded pool will hurt SQL Server I/O.
- Collect a baseline during a normal workload period. Compare future metrics to this baseline to detect anomalies early.
- Use
sp_Blitzorsp_BlitzCache(free scripts from Brent Ozar) for a quick health check. They summarize common issues in a readable format. - Consider using the SQL Server Performance Dashboard reports available in SSMS for a visual overview.
Troubleshooting
- If you see high CPU but no obvious query: Check for background processes like index rebuilds or statistics updates. Use
sys.dm_exec_requeststo see what's running, and look atsys.dm_exec_query_statsfor cumulative CPU. - If disk latency is high but the storage is healthy: Check if the SQL Server database files are on the same volume as the OS or other VMs. Move data files to a dedicated volume. Also verify that the VM's virtual disk is configured with the correct caching mode.
- If memory pressure persists: Review
sys.dm_os_memory_clerksto see which component is using memory. Sometimes it's not SQL Server but the host. If the host is low on memory, consider adding RAM or moving other VMs. - If blocking is frequent: Look at the application code. Often, a missing index or a long transaction causes locks. Use
sys.dm_db_index_usage_statsto find unused indexes andsys.dm_db_missing_index_detailsto find missing ones. - If Azure Monitor shows no data: Check that the Log Analytics agent is installed and connected. Verify the workspace is in the same region as your Azure Local resource. Also confirm that the SQL Server solution is enabled.
Frequently Asked Questions
What is the most important metric to monitor?
Wait statistics are the best starting point. They tell you what SQL Server is waiting on, which directly points to the bottleneck – CPU, I/O, or locks.
How often should I check performance?
For critical systems, set up real-time alerts and review trends weekly. For less critical ones, a monthly review may suffice.
Can I use the same methods on Azure SQL Managed Instance?
Some tools like SSMS reports and DMVs work similarly, but Azure SQL Managed Instance doesn't expose host-level counters. Use Azure Monitor's built-in SQL analytics instead.
Do I need a separate tool for monitoring?
No. SQL Server Management Studio, Performance Monitor, and Azure Monitor cover most needs. Third-party tools add convenience but aren't required.
What does Page Life Expectancy mean?
It's the number of seconds a page stays in the buffer pool. A low value (under 300) suggests memory pressure, but it's workload-dependent.
How do I monitor deadlocks?
Enable the deadlock trace flags (1222 or 1204) or use the system_health session in Extended Events. Azure Monitor also captures deadlock events.