onstat -g laq command: Print log apply queues
Use the onstat -g laq command to print information about log recovery apply queues.
Use the onstat -g laq command to print information about log recovery apply queues. This includes logical log recovery on secondary servers as well as logical restore or logical recovery part of fast recovery. Log records from logical logs are assigned to replay worker threads according to the tablespace ID (partnum) associated with them; a subset of log records will be applied by the replay master thread.
For instance, in a high-availability cluster, the primary server sends log records to one or more secondary servers over the network. Each secondary server continuously replays the transaction logs from the primary server to ensure that data is replicated on the secondary server. Each tblspace on the primary server is assigned a queue on the secondary server in which to receive log records. A replay thread applies the log records stored in the queue to the secondary server. The log records are applied in the order in which they were received.
You use the onstat -g laq command to monitor the performance of the log apply queues, on a secondary server or during any other form of log recovery. Use this command if you suspect that the primary server performance is slowed because logs are not replaying quickly enough on the secondary server, or to monitor the progress made during logical restore. The Avg Depth (average depth) column indicates the average number of log records in the queue(Queue Size) incurred whenever putting a new log record on a queue. The Current/Last LSN column specifies the log record a replay thread currently is active on, or the last one it was replaying, with the Partval column typically specifying the tablespace ID this log record refers to. Transaction pointer and ID shown for a replay thread indicate a log record currently being applied.
When used in repeat mode, using -r [<seconds>][.<fraction>] option, an overall log record apply rate is calculated and shown.
On a secondary server, the transaction latency measured, in full seconds, with each end-of-transaction(COMMIT, ROLLBACK) log record as difference between local apply time and primary server's EoT time, is shown.
The onstat -g laq command is valid only when some form of logical log recovery is going on, otherwise only an onstat header is printed.
Example output
Output description
- Thread
- The name of the apply thread for a given log record queue.
- Queue Size
- The number of log records queued for a given apply thread.
- Total Queued
- The total number of queued log records for a given apply thread.
- Avg Depth
- The average number of log records in the queue at the time a queue insert operation occurred.
- Secondary Apply Queue
- The secondary apply queue receives log buffers from the primary server. The values displayed represent the total number of buffers allocated to receiving log buffer records(SEC_DR_BUFS), the size of the buffers(LOGBUFF), and the number of currently unused buffers.
- Log Recovery Queue
- The log recovery queue receives output from the secondary apply queue. The log buffers are converted to a format compatible with the ontape utility. The values displayed represent the total number of stream buffers in the recovery queue, the size of the stream buffers(LTAPEBLK), and the number of unused buffers.
- Log Page Queue
- The log page queue receives output from the log recovery queue. The values displayed represent the total number of log pages in the queue, the size of the queue, and the number of unused buffers.
- Log Record Queue
- The log record queue receives output from the log page queue. The log pages are divided into individual log records. The values displayed represent the total number of log records in the recovery queue, the size of the queue, and the number of unused buffers.
- Transaction Latency
-
Time difference between last replayed transaction commit time at primary server and local server. For this to be accurate, operating system time must match between primary and secondary servers.
- Apply rate
-
Number of log records replayed per second. Apply rate is only shown with -r option.