Quick Answer
HADR_TIMER_TASK waits occur when Always On Availability Groups background timer tasks sleep between scheduled executions, typically waiting 10 seconds between health checks and maintenance operations. This is completely benign background activity that should be filtered from wait statistics analysis since it represents normal sleeping, not actual performance bottlenecks.
Root Cause Analysis
The Always On Availability Groups subsystem runs continuous background timer tasks to manage replica health monitoring, lease renewals, automatic failover detection, and synchronization status checks. These tasks execute on predictable intervals, commonly every 10 seconds, and use HADR_TIMER_TASK waits during their sleep periods between executions.
The wait occurs in two scenarios: first, when acquiring locks on timer task objects to ensure thread safety during task scheduling, and second, during the actual sleep intervals between task executions. The timer subsystem uses Windows thread pool timers and SQL Server's internal scheduler to manage these recurring operations.
Since SQL Server 2012, this behavior remains consistent across versions. The wait accumulates substantial time because these background processes run continuously, sleeping far longer than they execute. A healthy Always On environment will show thousands of HADR_TIMER_TASK waits with high total wait time but extremely low signal wait time, indicating the threads are properly sleeping rather than spinning or blocking on resources.
AutoDBA checks Always On health monitoring, wait type classification, and performance bottleneck identification across your entire SQL Server instance in 60 seconds. Download the free diagnostic script and see what else needs attention.
Diagnostic Queries
-- Verify HADR_TIMER_TASK is benign background activity
SELECT
wait_type,
waiting_tasks_count,
wait_time_ms,
signal_wait_time_ms,
wait_time_ms - signal_wait_time_ms AS resource_wait_time_ms,
CAST(100.0 * signal_wait_time_ms / wait_time_ms AS DECIMAL(5,2)) AS signal_wait_percentage
FROM sys.dm_os_wait_stats
WHERE wait_type = 'HADR_TIMER_TASK';
-- Wait stats analysis excluding benign waits
WITH wait_stats AS (
SELECT
wait_type,
wait_time_ms,
waiting_tasks_count,
CAST(100.0 * wait_time_ms / SUM(wait_time_ms) OVER() AS DECIMAL(5,2)) AS wait_percentage
FROM sys.dm_os_wait_stats
WHERE wait_type NOT IN (
'HADR_TIMER_TASK', 'SLEEP_TASK', 'WAITFOR', 'LAZYWRITER_SLEEP',
'XE_DISPATCHER_WAIT', 'BROKER_TO_FLUSH', 'SQLTRACE_INCREMENTAL_FLUSH_SLEEP'
)
AND wait_time_ms > 0
)
SELECT TOP 20 * FROM wait_stats ORDER BY wait_time_ms DESC;
Prevention
No prevention is required since HADR_TIMER_TASK waits represent normal Always On background operations. Attempting to eliminate these waits would break Always On functionality. Focus monitoring efforts on actionable waits that indicate resource contention, blocking, or hardware bottlenecks. Professional monitoring tools automatically filter benign waits, allowing DBAs to concentrate on performance issues that require intervention rather than getting distracted by healthy background processes.
Need hands-on help?
Dealing with persistent hadr_timer_task issues across your environment? Samix Technology provides hands-on SQL Server performance consulting with 15+ years of production DBA experience.