DIRTY_PAGE_TABLE_LOCK Wait Type in SQL Server

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

Is It a Problem?

It can be, on a readable secondary under the right mix. The secondary replica redo model write-up lists it among the parallel redo waits that slow things down: read-only queries on the secondary apply pending redo as they scan pages, and they have to coordinate with the redo workers through this lock, which can slow both redo and the queries when they run at the same time. The readers do not have to touch the tables being updated, because the contention is on the list of dirty pages itself.

The same write-up says the performance issue behind this wait was fixed in cumulative updates for SQL Server 2016 SP and SQL Server 2017, after which the wait should no longer be generated. So on a current, patched build, check the build first. Get Wait Statistics does not filter it out, so if it ranks, you will see it.


What It Means

Microsoft lists it as internal use only, from SQL Server 2016. The redo write-up describes a wait on the lock that controls access to the dirty page table, which holds the modified pages that need flushing; with parallel redo, log waiting to be redone is attached to dirty page entries. Its sibling DPT_ENTRY_LOCK is the same contention on individual entries, when redo and a query want the same pages.


When It Does Matter

When a readable secondary slows down under reporting load while the primary is writing heavily. Compare redo throughput with and without the queries running, using the replica counters on the secondary:

SELECT
    instance_name AS database_name,
    counter_name,
    cntr_value
FROM sys.dm_os_performance_counters
WHERE object_name LIKE N'%Database Replica%'
  AND counter_name IN (N'Redone Bytes/sec', N'Redo Bytes Remaining')
ORDER BY instance_name, counter_name;

Redone Bytes/sec is cumulative here, so take two readings. The baseline to monitor is redo throughput during your reporting window against outside it. If it drops sharply while reports run, separate the heaviest write and read windows where you can, cut write volume on the primary such as broad index maintenance, or spread readers over more replicas. Trace flag 3459 gives serial redo as a last resort, with the warning that only a restart turns parallel redo back on.


The HADR Secondary Replica Waits

These are the Availability Group waits around redo on a secondary, readable secondaries in particular, and the asynchronous work tasks behind AG operations. For AG latency, start from the main page, HADR_SYNC_COMMIT.

  • HADR_SYNC_COMMITSynchronous commit. The primary waiting for a synchronous secondary to harden the log.The main page for this family
  • DIRTY_PAGE_TABLE_LOCKDirty page table. Redo and read queries on a readable secondary contending for the list of dirty pages.Worth investigating. This page.
  • DPT_ENTRY_LOCKDirty page entries. The same contention when redo and reads want the same pages.Worth a look when it climbs
  • REDO_THREAD_PENDING_WORKRedo idle. A redo thread on a secondary waiting to be told there is more log to redo.Usually noise
  • PWAIT_HADR_WORKITEM_COMPLETEDAG operations. Waiting for an asynchronous AG work task to complete.Worth a look when it climbs

Where To Go Next

If DIRTY_PAGE_TABLE_LOCK is climbing on a readable secondary, these are the next places to look.

Comments

Leave a Reply

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