Module 4 - Monitor and Optimize Operational Resources Flashcards
What is the Azure Monitor
Platform Monitor that captures and displays standard metrics
How can additonal metrics be captured with Azure Monitor
Using Monitoring Insights to capture additional data from you VM
How can Azure Monitor show detailed metrics appertaining to SQL Server
It can’t, Azure Monitor will show VM level information only
What additional Data does Azure Monitoring Insights capture from the VM
Azure Monitoring Insights add the ability to capture Storage Latency, Available Memory and Disk capacity
Where is data from Monitoring Insights stored and how can you query it
Monitoring Insights data is stored within Azure Log Analytics and can be queried via KQL (a SQL like langues)
Azure Log Analytics is the primary tool for storing log files
What does the SQL VM Resource Provider, provide and how/when can it be installed?
SQL VM resource provider provides a dashboard showing a view of data and log file space consumption on disk as well as management of Auto patching and Storage Config.
Installed Automatically when deploying a SQL VM from market place or you can install it seperately on an existing VM
What does Perf Mon on a SQL VM allow?
Where can Perf Mon data be stored
Perf Mon allows easy monitoring of performance metrics at an OS and SQL level
SQL has its own counters in perfmon
Perform data can be stored locally or forwarded to Azure monitor so you can have single view of multiple servers
Metrics gathering by Azure Monitor are a gateway for alerting process, describe Azure Monitor Metrics
Azure Monitor Metrics is a powerful subsystem to analize/visualise and alert on metrics
Alerts can notify admins or trigger automatic runbooks/webhooks
How can Azure Monitor Metrics alerts for VMs be scoped
Azure Monitor Metrics alerts for VMs can be scoped in 3 ways
All VMs in a region in a subscription
All VMs in a region in one or more resource groups in a subscription
A list of VMs in a region in a subscription
Give an overview of how to create an Azure Monitor Metrics alert?
Create New Alert rule - specify rule conditions
Create action group - specify actions to take upon conditions being met
How long do Azure Monitor Metrics get retained for and what should you do if you want them for longer
Azure Monitor Metrics get retained for 93 days at which point they are purged unless archived in AZure Storage
There a lots of metrics in SQL Server, where can you get OS level metrics of interest, within a VM
Some OS Level metrics are available from within SQL (SSMS) others are just available at the OS level.
E.G. Combine Volume stats (data and log file read/write latency) from sys.dm_os_volume_stats DMV with the OS metric seconds per disk read/write which is only available at the OS level.
The above gives a better understanding if an issue is due to storage bottle neck or DB structure issue.
Its important to correlate SQL Stats with OS Stats, if you are using a Linux VM what tools can you use to get similar data that is available in PerfMon
InfluxDB,
CollectD
Grafena
There are various OS metrics that can be used to capture a good baseline with regards to SQL Workload, what are some of these metrics
Processor Total % Time Paging File Usage Physical Disk Avg Read/Write per second Sys/Processor Queue length SQL Buffer Manager/PLE SQL Batch Requests per sec SQL Compilations or Recompilations per sec
What does “Processor Total % Time” do and why is that useful for baselining SQL Server performance
Processor Total % Time measures CPU utilization and is good indicator of workload, can identify query performance issues
What does “Paging File Usage” do and why is that useful for baselining SQL Server performance
Paging File Usage - If SQL Config is correct memory should not be paged out however often apps may cause this to happen resulting in performance degradation.
What does “Physical Disk Avg Read/Write per second” do and why is that useful for baselining SQL Server performance
Physical Disk Avg Read/Write per second metric to check storage sub system (latency should not be above 20ms - with Premium Storage should be less than 10ms)
What does “Sys/Processor Queue length” do and why is that useful for baselining SQL Server performance
Sys/Processor Queue length - number of threads waiting on processor, anything greater than 0 indicates CPU pressure
What does “SQL Buffer Manager/PLE” do and why is that useful for baselining SQL Server performance
SQL Buffer Manager/PLE - How long SQL expects a page to be in memory, whilst there is no ‘good’ number here, if you monitor over time you will be able to identify if the number suddenly drops which would suggest memory pressure.
What does “SQL Batch Requests per sec” do and why is that useful for baselining SQL Server performance
SQL Batch Requests per sec - helps evalute is system is consistently busy, use with “Proccessor Total % Time” to understand workload and baselines
What does “SQL Compilations or Recompilations per sec” do and why is that useful for baselining SQL Server performance
SQL Compilations or Recompilations per sec - When SQL has to (re)compile executions plans due no plan being in the cache (or because the plan was invalid) can indicate recompile query hints, memory pressure on plan cache due to lots of ad-hoc queries or memory pressure
Describe Wait Statistics?
SQL tracks threads forced to wait on unavailable resources.
Can help when tracking specific query problems or looking at baselines
Which DMV holds wait stats info
Wait Stat info available via sys.dm_os_wait_stats
What is Azure SQL Database Intelligent Insights
Azure platform built in performance collection allowing analysis of queries
What does Azure SQL Database Intelligent Insights use behind the scenes to get it’s data
Query Store
What are the storage options for Intelligent Insights
Azure Storage (Stored as extended events session files), only viewable on server that created them Events Hub (Stored in Avro format a Binary of JSON for event reporting) Log Analytics (Queried using KQL)
Which tool in the Azure portal allows quick identification of expensive queries
Query Performance Insight allows the administrator to quickly identity expensive queries.
Why was it previously difficult to capture data related to query executions and what tool has made it easier
It was previously difficult to capture data related to query executions due to it’s transient nature being held in memory. It is now much easier with Query Store
What 2 types of data does Query Store collect?
Query Store collects Data about queries (plan, query text and # of executions) as well as data about performance (runtime stats for each execution)
Query store is designed to us minimal over head - what about the architecture of query store achieves this?
Query store writes data to memory which is then flushed to disk on a schedule
What are the default settings related to query store
Max Size MB = 100MB (often changed to 1 - 2 GB)
Time Based Clean Up = 30 days
Query Capture Mode = Auto (meaning that queries with insignificant times are ignored), old default was ALL
Describe plan forcing in query store
Plan forcing drives the new Auto tune feature of (Use last good plan)
You would use plan forcing to allow quick mitigation whilst you investigate properly.
What is the purpose of locking
Locking is used to maintain Atomicity and Consistency?
When does blocking occur?
Blocking occurs when one process holds a lock on a specific resource (row, page, table, database), and a second process attempts to acquire a lock with an incompatible lock type on the same resource
SQL attempts to take the smallest lock possible to allow maximum concurrency, however each lock has a performance overhead - at what point is lock escalation used and what is lock escalation
SQL Server tries to balance concurrency with cost. One technique used is called lock escalation. If SQL Server needs to lock more than 5000 rows on a single object in a single statement, it will escalate the multiple row locks to a single table lock.
What is deadlocking?
When 2 transactions have locks on individual resources and each transaction then tries to take a lock (and ends up being blocked) on the other transcations locked resource.