Professional Documents
Culture Documents
Tuning The Redolog Buffer Cache and Resolving Redo Latch Contention
Tuning The Redolog Buffer Cache and Resolving Redo Latch Contention
This article provide detailed information to understand How the Redolog Buffer Cache Works
and How to detect and resolve tuning problems related with this SGA structure.
Contents:
1. What is the Redolog Buffer
2. Redolog Latches
Redo Copy latch
Redo allocation latch
Redo writing latch
3. Instance Parameters Related with the Redolog Latches
4. Tuning Redolog Buffer Performance
Latch contention
Request for space contention
zero value, and the size of the transaction entry is smaller than the value of the
LOG_SMALL_ENTRY_MAX_SIZE parameter then the copy of the transaction entry into the
log buffer cache is performed by the redo allocation latch. If the size of the transaction entry
exceeds LOG_SMALL_ENTRY_MAX_SIZE, then the transaction entry is copied into the log
buffer cache by the redo copy latch.
In Oracle8i and Oracle9.0, a redo copy latch is always required regardless of the redo size so the
check is no longer performed. The init.ora LOG_SIMULTANEOUS_COPIES becomes obsolete
and the number of redo copy latches defaults to twice the number of cpus. The parameter
LOG_SMALL_ENTRY_MAX_SIZE is also obsolete. For further detail on the change of this
parameters in Oracle 8i seeNote:94271.1
In Oracle9.2 and higher, multiple redo allocation latches become possible with init.ora
LOG_PARALLELISM. The log buffer is split in multiple LOG_PARALLELISM areas that each
have a size of init.ora LOG_BUFFER. The allocation job of each area is protected by a specific
redo allocation latch. The number of redo copy latches is still determined by the number of cpus
4. Detecting and Resolving Redolog Buffer Performance Problem
Contention in the redolog buffer will impact the performance of the database since all DML and
DDL must record a entry before being executed. Contention can be seen as a latch contention or
as excessive request for free space in the log buffer.
Note: In general log buffer contention is not frequent problem unless the latches already
mentioned are consistently in the top wait events. Experience usually shows redo IO
throughput is the main culprit of redo contention.
The database allows you to detect both types of contention as described below:
o Latch contention
The following query determines the miss ratio and the "immediate" miss ratio for
redolog latches.
SELECT substr(ln.name, 1, 20), gets, misses, immediate_gets, immediate_misses
FROM v$latch l, v$latchname ln
WHERE ln.name in ('redo allocation', 'redo copy')
and ln.latch# = l.latch#;
If the ratio of MISSES to GETS exceeds 1%, or the ratio of
IMMEDIATE_MISSES to (IMMEDIATE_GETS + IMMEDIATE_MISSES)
exceeds 1%, there is latch contention.
Note: Oracle recommends to tune first the redo allocation latch rather than
the redo copy latch.
In Oracle7 and Oracle8.0:
If the contention is caused by redo allocation latch decrease the value of
LOG_SMALL_ENTRY_MAX_SIZE. The recommended value is the average of
redo size which can be calculated as (redo size/redo entries) from V$SYSSTAT.
If you find redo copy latch contention, you can increase the parameter
LOG_SIMULTANEOUS_COPIES to have more latches available. The
recommended value is twice the numbers of CPUs.
In Oracle8i and Oracle9.0:
If the contention is caused by redo allocation latch you can either use the
NOLOGGING option to reduce the amount of redo log entries for certain
operations (See Note:147474.1) or reduce the load on the latch increasing the
LOG_BUFFER PARAMETER.
If you find redo copy latch contention, you can increase the hidden init.ora
_LOG_SIMULTANEOUS_COPIES to have more latches available. The default is
twice the numbers of CPUs.
In Oracle 9.2:
If the contention is caused by redo allocation latch you can try to increase their
number via init.ora LOG_PARALLELISM
If you find redo copy latch contention, you can increase the hidden init.ora
_LOG_SIMULTANEOUS_COPIES to have more latches available. The default is
twice the numbers of CPUs.
In Oracle 10.2 and higher:
The statistic REDO BUFFER ALLOCATION RETRIES reflects the number of
times a
user process waits for space in the redo log buffer. The value of redo buffer
allocation retries should be near zero over an interval. If this value increments
consistently, then processes have had to wait for space in the redo log buffer.
The wait can be caused by the log buffer being too small or by checkpointing.
Increase the size of the redo log buffer, if necessary, by changing the value of
the initialization parameter LOG_BUFFER. The value of this parameter is
expressed
in bytes.
In 11.2, there is also Bug 13520743 - HIGH REDO LATCH CONTENTION ON
'REDO ALLOCATION', closed as not a bug:
The following parameter is used to reduce Redo Allocation contention:
"_log_parallelism_max".
The bug instructs to set _log_parallelism_max values of 4,5,6 and measure the
improvement based on AWR reports.