LOGMGR_FLUSH Wait Type in SQL Server

Part of the SQL Server Wait Types Library.
Related deep dive: WRITELOG Wait Type.


LOGMGR_FLUSH is a wait recorded when a thread generating a transaction log record has to pause until the current log flush completes. From SQL Server 2016 onward the engine runs multiple background log writer threads (up to four, then up to eight in SQL Server 2019), and this wait belongs to that flush pipeline: a writer wants to add to the log while a flush of the current block is still in flight.

It is a close relative of WRITELOG. WRITELOG is a session waiting for its commit to harden; LOGMGR_FLUSH is a thread waiting on the mechanics of the flush itself.

Is It a Problem?

Rarely on its own. It has not historically been a noticeable contention point, and small amounts are just the log pipeline breathing. It becomes interesting when it appears alongside elevated WRITELOG, because both point at the same physical bottleneck: the transaction log cannot be written fast enough for the volume of log being generated.

Treat the pair as one signal rather than chasing LOGMGR_FLUSH separately.

Common Causes

  • Slow log-drive write latency, the same root cause as WRITELOG pressure.
  • Very high log generation rates, bulk loads, index rebuilds, or heavy churn on wide rows, saturating the flush pipeline.
  • Log files sharing spindles or LUNs with data files or tempdb, so log flushes queue behind other I/O.

What To Do

  1. Measure log write latency first: sys.dm_io_virtual_file_stats write stall per write on each log file. Single-digit milliseconds is healthy; tens of milliseconds is your bottleneck.
  2. Fix the storage path if latency is high. Dedicated, low-latency storage for the log file gives the flush pipeline room.
  3. Reduce log volume: minimally logged operations where appropriate, fewer and larger transactions instead of row-by-row commits, and index maintenance tuned to only what needs rebuilding.
  4. Confirm with the WRITELOG picture. If WRITELOG is quiet, LOGMGR_FLUSH on its own is not worth engineering time.

How To See It

Rank it against everything else with Get-WaitStatistics. Read it together with WRITELOG and your log file latency numbers.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *