Anthony Nocentino, experienced Enterprise Architect and Friend of Redgate, explains the challenges presented by monitoring Availability Groups and shows you a technique for monitoring AG replication latency with Redgate SQL Monitor and its Custom Metric functionality.
This metric measures the amount of memory used by the total number of ad-hoc queries that are currently in the plan cache. If the value is high, it indicates memory is being wasted by storing the execution plans of queries that will never be run more than one time.
This metric shows Writelog wait time in ms, per elapsed second. Writelog wait types occur when the log cache is being flushed to disk. If this happens all the time, it may suggest disk bottlenecks where the transaction log is stored.
This metric collects the number of 8-kilobyte pages that make up the plan cache to help identify memory pressure or plan cache pollution. A sudden drop in values for this metric may indicate that the instance is under memory pressure and SQL Server had to reclaim part of the plan cache for other use.
This alert is raised when the number of hash warnings events in the last hour goes above a specified threshold. A hash warning event means that part of the data processed for a hash operation was written to tempdb during query execution, which can degrade SQL Server Performance.
If your code uses temporary tables, variable tables or dynamic cursors, this metric can help identify whether you have contention on tempdb allocation. Tempdb is shared by all databases and is used for many operations in a SQL Server instance, so it is common for tempdb to cause performance problems.
This metric can help if you want to monitor the number of indexes per database that haven't been used for the last month. Indexes that aren't in use should be removed because they can degrade INSERT, UPDATE and DELETE performance, and they use storage space.
This is a general indicator of performance problems. Index fragmentation can affect the rate of return for moderate to large tables. If this value indicates an increased amount of index fragmentation throughout your database, you may need to fine-tune your indexes by redesigning, or rebuilding more frequently.