PARALLEL_REDO_TRAN_TURN 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: High Availability
⚡PARALLEL_REDO_TRAN_TURN is a redo thread on a readable secondary waiting for another redo thread to finish a log record that has to be applied first. It is one of the two parallel redo waits that can actually slow redo down. The cause sits on the primary: page splits and forwarded records in heaps. Run the check to confirm the redo lag and then look at the primary.

Microsoft lists it as internal use only, from SQL Server 2016. The secondary replica redo model write-up explains it: a redo worker waiting for a dependent log record to be redone, often by a different worker, which only happens on a readable secondary, when inserts trigger page split system transactions or updates to a heap create forwarded records.


Is It a Problem?

It can be. Depending on how often inserts happen, it can significantly slow down parallel redo, and its frequency is generally proportional to the volume of inserts. If your readable secondary falls behind and this wait features, that is the likely reason.

The baseline to monitor is redo_queue_size on the secondary; this wait matters when it rises together with that queue.


Common Causes

  • Page splits on the primary from inserts into indexes, often visible there as PAGELATCH_EX and fragmentation.
  • Heaps on the primary taking updates that create forwarded records.
  • Bursts of insert-heavy work in load windows.

The Check To Run

On the secondary, rank it against everything else with Get Wait Statistics and confirm the redo lag in sys.dm_hadr_database_replica_states, or with Check Always On Availability Group Latency. Then, on the primary, check the split rate; the counter is cumulative, so read it twice and take the difference:

SELECT
    object_name,
    counter_name,
    cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = N'Page Splits/sec'
  AND object_name LIKE N'%Access Methods%';

Get Heaps lists the heaps on the primary, and the ones taking updates are the forwarded record candidates. The queries need VIEW SERVER STATE.


What To Do

  1. Reduce page splits at the source: a lower fill factor on the indexes taking random inserts, and index maintenance that keeps them in shape.
  2. Give heaps that take updates a clustered index, which removes forwarded records.
  3. Re-measure the redo rate on the secondary after the change.
  4. Trace flag 3459 switches the instance to serial redo. Once on, only a service restart brings parallel redo back, so treat it as a last resort to test, not a fix.

The PARALLEL_REDO Family

These are the parallel redo waits, recorded on Availability Group secondaries and during database recovery. They split into waits that can slow redo and idle waits with no performance impact. 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
  • PARALLEL_REDO_FLOW_CONTROLDispatch blocked. The main redo thread cannot hand out more log because the workers are not keeping up.Worth investigating
  • PARALLEL_REDO_TRAN_TURNOrdering stall. A worker waiting for a dependent log record on another worker, on a readable secondary.Worth a look when it climbs. This page.
  • PARALLEL_REDO_WORKER_WAIT_WORKIdle worker. A redo worker with nothing to do, usually because the primary is quiet.Usually noise
  • PARALLEL_REDO_DRAIN_WORKERDrain. The main redo thread waiting for all outstanding redo to finish, at a checkpoint or file size change.Usually noise
  • PARALLEL_REDO_WORKER_SYNCWorkers stopping. Waiting for the parallel redo workers to stop.Usually noise
  • PARALLEL_REDO_LOG_CACHELog cache lock. An infrequent lock on the dispatched-log cache, after flow control.Usually noise
  • PARALLEL_REDO_TRAN_LISTTransaction list lock. An infrequent lock on the list of transactions that are fully redone.Usually noise

Where To Go Next

If PARALLEL_REDO_TRAN_TURN is showing up on a lagging secondary, these are the next places to look.

Comments

Leave a Reply

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