AlwaysOn等待类型
当排查AlwaysOn延迟,等待统计信息可以在DMV中查看累计的AlwaysOn等待类型。
查看AlwaysOn等待类型
SELECT * FROM sys.dm_os_wait_stats
WHERE wait_type LIKE '%hadr%'
ORDER BY wait_time_ms DESC
使用一下语句,获取捕获扩展事件,等待类型。
CREATE EVENT SESSION [alwayson] ON SERVER
ADD EVENT sqlos.wait_info(
WHERE ([wait_type]=(758) OR [wait_type]=(776) OR [wait_type]=(853) OR [wait_type]=(833)))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,
MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO
可以通过以下查询,查看等待类型的k-v映射
SELECT * FROM sys.dm_xe_map_values
WHERE name='wait_types' AND map_value LIKE '%hadr%'
ORDER BY map_key ASC