SLEEP_BPOOL_FLUSH Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: IO_COMPLETION Wait TypeRelated pillar: Performance & Troubleshooting

Is It a Problem?

Normally no. It is one of the standard benign waits, and Get Wait Statistics filters it out by default. The checkpoint writes themselves are recorded as ASYNC_IO_COMPLETION, so this wait is the pauses between them.


What It Means

Microsoft’s definition: it occurs when a checkpoint is throttling the issuance of new I/Os to avoid flooding the disk subsystem. The thresholds: the checkpoint backs off when it sees average write latency of about 20 ms, or 100 ms during shutdown, and pauses for a few milliseconds to let in-flight writes finish. He also notes it can come from a checkpoint that is blocked.


When It Does Matter

Two cases. If it is large and constant, the checkpoint keeps backing off, which tells you the data files have little write headroom; check per-file write latency:

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'ROWS'
ORDER BY vfs.io_stall_read_ms + vfs.io_stall_write_ms DESC;

The second case is a blocked checkpoint. A known example is starting a data backup, which performs a checkpoint, while the database is being encrypted for Transparent Data Encryption; the wait can then be one of the top waits. If a backup seems to hang before it starts, check for an encryption scan first. The baseline to monitor is data file write latency against its own history. The query needs VIEW SERVER STATE.


The SLEEP Family

These are the sleep waits: threads pausing on purpose, at startup, between checkpoint writes, or while they wait for memory to free up. Most are filtered as benign, but the buffer pool memory sleeps are a memory pressure signal. If one is near the top of your waits, read it next to the waits that usually matter.

  • SLEEP_BPOOL_STEAL and memory sleepsNo free memory. Free list stalls and helping the lazy writer; a memory pressure signal when they rise.Worth a look when it climbs
  • SLEEP_BPOOL_FLUSHCheckpoint throttle. A checkpoint holding back new I/O so it does not flood the disks.Usually noise. This page.
  • SLEEP_DBSTARTUP and startup sleepsStartup. Waiting for databases, master and DCOM to finish starting.Usually noise
  • SLEEP_TASKGeneric sleep. A task sleeping while it waits for a generic event.Usually noise
  • LAZYWRITER_SLEEPLazy writer idle. The lazy writer suspended between runs.Usually noise

Where To Go Next

SLEEP_BPOOL_FLUSH is background noise on a healthy instance. If you are chasing a real problem, start with the waits that cost you time.

Comments

Leave a Reply

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