LOGBUFFER Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: WRITELOGRelated pillar: Storage & Capacity
⚡LOGBUFFER is a session waiting for space in the log buffer to store a log record, because buffers are not being flushed to disk fast enough. Consistently high values might mean the log devices cannot keep up. Run the check to read log file write latency.

Microsoft’s definition: it occurs when a task is waiting for space in the log buffer to store a log record, and consistently high values might indicate the log devices cannot keep up with the log being generated. It is waiting for a free log buffer so the current log block, which ends at 60 KB or at a commit, can be copied into the log cache and then written.

It often travels with WRITELOG: LOGBUFFER is no room to stage the record, WRITELOG is the commit waiting for its flush.


Is It a Problem?

Some is normal on write-heavy systems. It also appears after a database comes online, while the log cache grows from one buffer to its maximum of 128 per database, so a burst just after a restart is expected. It deserves focus when it stays high with WRITELOG, which means the log pipeline is saturated end to end. Our SQL Server 2025 lab had 133 waits totalling 0.2 seconds in a day. Get Wait Statistics does not filter it out, so if it ranks, you will see it.

Judge it over an interval rather than the cumulative totals. The baseline to monitor is each log file’s average write latency against its own history.


Common Causes

  • Slow log writes keeping the buffers full.
  • Very high log generation from mass modifications.
  • Log files sharing storage with data files or tempdb.

The Check To Run

Rank it against everything else with Get Wait Statistics, then read write latency on the log files:

SELECT
    DB_NAME(vfs.database_id) AS database_name,
    mf.type_desc,
    mf.physical_name,
    vfs.num_of_reads,
    CAST(vfs.io_stall_read_ms * 1.0 / NULLIF(vfs.num_of_reads, 0) AS DECIMAL(12, 2)) AS avg_read_ms,
    vfs.num_of_writes,
    CAST(vfs.io_stall_write_ms * 1.0 / NULLIF(vfs.num_of_writes, 0) AS DECIMAL(12, 2)) AS avg_write_ms
FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS vfs
JOIN sys.master_files AS mf
    ON mf.database_id = vfs.database_id AND mf.file_id = vfs.file_id
WHERE mf.type_desc = N'LOG'
ORDER BY vfs.io_stall_read_ms + vfs.io_stall_write_ms DESC;

The counters are cumulative since restart, so compare two readings. The query needs VIEW SERVER STATE.


What To Do

  1. Put the log on dedicated low-latency storage; log writes are sequential and latency-sensitive.
  2. Reduce log volume where the design allows: batch small commits, avoid needless index churn, and use minimally logged operations for bulk work.
  3. Where the business accepts a small window of possible data loss, delayed durability removes the commit-time flush wait; understand the trade before using it.

The LOG Family

These are the transaction log waits: sessions waiting for log to be written, for room in the log buffer or the log file, and the log writer itself idling. The one that usually costs users time is the main page, WRITELOG.

  • WRITELOGLog flush. A session waiting for its log records to be written to disk.The main page for this family
  • LOGBUFFERLog buffer. Waiting for space in the log buffer to store a log record.Worth a look when it climbs. This page.
  • LOGMGR_RESERVE_APPENDLog space. Waiting to see whether truncation frees space in a full log.Worth a look when it climbs
  • LOGMGR_FLUSHFlush in progress. Documented for information only; reported as waiting for the current log flush.Usually noise
  • LOGMGR_QUEUELog writer idle. The log writer waiting for work requests.Usually noise
  • LOGMGRClosing the log. Waiting for outstanding log I/O before the log shuts down as a database closes.Usually noise
  • LOGPOOL waitsLog pool. The in-memory cache of recently flushed log blocks.Usually noise

Where To Go Next

If LOGBUFFER is sitting near the top of your wait stats, these are the next places to look.

Comments

Leave a Reply

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