Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: LRU latches

Re: LRU latches

From: kyle hailey <oraperf_at_yahoo.com>
Date: Mon, 26 Feb 2001 21:26:23 -0800
Message-ID: <4adm9tscpum7gco7s15tf4fdojqo9r9hr1@4ax.com>

For the log buffer latch questions see:
http://www.geocities.com/oraperf/redo/redo_alloc_latch.html I've pasted the page below. The LRU stuff is for the buffer cache, maybe someone else wants to address that - or maybe I could write it up later.

Log Buffer Latching:

Normally only one process writes to the log buffer in the SGA at a time. The redo allocation latch assures that only one user can write to the log buffer at a time. A user aquires the redo allocation latch writes to the redo log buffer then releases the redo allocation latch. In order reduce the contention on the redo allocation latch we need to reduce the amount of time that users hold the redo allocation latch. This is accomplished by using the redo allocation latch not to write to the log buffer but just to allocatate the necessary space in the log buffer for the process. After the process has allocated the necessary space it can use a redo copy latch to write into the log buffer. There can be multiple redo copy latches.

The redo copy latches allows process to concurrently write into the log buffer. The number of redo copy latches is determined by the parameter LOG_SIMULTANEOUS_COPIES.

Even with LOG_SIMULTANEOUS_COPIES set to greater than 0, the processeses will continue to write to the log buffer using the redo allocation latch if their log entry size is smaller than the parameter LOG_SMALL_ENTRY_MAX_SIZE. So both LOG_SIMULTANEOUS_COPIES and LOG_SMALL_ENTRY_MAX_SIZE need to be set to alleviate contention on the redo allocation latch.

The algorithm is the following (early V7 but idea is the same 7+ and v8)

        if  ( log entry size > LOG_SMALL_ENTRY_MAX_SIZE ) and
            ( LOG_SIMULTANEOUS_COPIES > 0 ) then   
              get the redo allocation latch
              allocate the memory
              get a redo copy latch
              release the redo allocation latch
              write the redo entry
              release the redo copy latch
        else
              gets the redo allocation latch
              writes into the log buffer
              release redo allocation latch
        fi

From Graham Wood:
Q: Why would there be both immediate requests and willing-to-wait requests for a
copy latch - I see both of them in my v$sysstat output. A: Foreground processes do immediate requests, log writer willing to wait (must
get all the latches before it can write).

From Richard Exley
You may be interested to know that at Oracle 8 the redo copy latches (parent
and children) become shareable. This means that, on platforms that support
it, more than one process can hold the same latch in share mode at the same
time.
In the new scheme, the foregrounds get the copy latch in share mode, and LGWR
gets all the latches in exclusive mode before it writes. This, I imagine,
will remove the need for multiple copy latches on these platforms, in fact
setting log_simultaneous_copies=1 should improve performance. Shareable latch functionality is only available on some platforms. For
example, from the code it appears that shareable latches are available on
Solaris but only for ultra sparc processors. Anyone had any experience working with this? Comments are welcome.

note1:

            Redo latch order of obtaining:
                Before 7.3 the redo allocation latch was gotten first
and then
                the redo copy latch (if it was configured). In 7.3
that was
                changed to first get the copy latch and then the
allocation
                latch.
		This reduces contention on the allocation latch should
                the process be unable to get the copy latch.


note2:      average  log entry size can be caculated by 
                    log entry size = ( redo size / redo entries )
note3:      Alpha (both VMS and Unix) ports ignore
log_simultaneous_copies. 
            Copy latches are not used.



References:
LOG_SIMULTANEOUS_COPIES
LOG_SMALL_ENTRY_MAX_SIZE
Questions or comments ? Send a note to oraperf_at_yahoo.com

Best
Kyle Hailey

On Sat, 24 Feb 2001 17:03:21 GMT, "Thomas Tomello" <tom_at_tatsoft.com> wrote:

>Could someone explain LRU latches and the relationship of these to the
>LOG_SIMULTANEOUS_COPIES and LOG_SMALL_ENTRY_MAX_SIZE parms? Thanks...
>
Received on Mon Feb 26 2001 - 23:26:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US