Database Reference
In-Depth Information
of global cache traffic. Reducing the amount of global cache traffic by implementing service to instance affinity and
object to instance affinity would help reduce the gc element latch waits. High gc element latches could be of serious
concern and should be reported to Oracle support. For the curious minds, a trace using event 10899 or gc_elements
dump of the global cache element could help in identifying the problem areas.
Redo Allocation
Redo log buffers hold information about changes made to the database. Changes are stored in redo entries. These
entries contain information required to reconstruct or redo the changes made to the database. The server process
copies these redo entries from the users memory area into the redo log buffer area. The LGWR process writes the redo
log buffer data into the redo log files.
When a user process needs to make a change to the data block, it creates a redo record in the redo log buffer by
executing the following steps:
Ensure no other process has generated a higher SCN.
Find buffer space to write the redo record. If no sufficient space is available, it forces LGWR
write operation or issues a log switch.
Allocate sufficient space required to write the redo log record to the buffer.
Copy the redo record to the log buffer and link it to the appropriate structures for
recovery purposes.
Any time buffer activity is involved, and Oracle processes need to determine if the buffer is free or if the buffer can
be written or cleaned, the process would need a latch. A redo allocation latch is required to allocate space in the log
buffer for each transaction entry. Subsequently, during a log switch operation or when buffer space needs to be freed
for other redo entries, the latch is released.
Similar to the redo allocation latch, there are two other latches associated with redo: redo copy latch and redo
writing latch. The redo copy latch is acquired in “no-wait” mode for the entire duration of the operation and released
when a log switch is initiated to free up buffer space. It indicates that a process is copying redo into the log buffer and
that the LGWR should wait until the copy has finished before writing the target log buffer blocks to disk. Redo writing
latch is to prevent multiple LGWR processes requesting for log switches simultaneously. When a process needs to free
redo log buffer space, it acquires this latch before the LGWR can perform a write operation. Latch waits may show
high waits when writes take longer than expected. This is normally reflected as a resource issue when Oracle triggers
log file sync ” wait event. The log file sync wait event is discussed later in the chapter.
As discussed earlier, if a latch is not available, the process goes into sleep mode for 1 centi-second and tries again;
if not found, it goes into sleep again for 1 centi-second and then for 2 centi-seconds, with the wait time increasing
through several iterations until such time the latch is obtained. Most of the time during a second or third iteration,
the O/S makes the latch available to the process; however, this may not be always the case. Latches assigned to the
process by the O/S also depend on the level of priority that the process is currently scheduled to run.
In an O/S such as Linux kernel 2.6, CPU and other resources are allocated to tasks or processes that are
scheduled. Like memory, CPU is a shared resource for which processes contend for a slice of time to complete their
operations. The O/S decides how to apportion this resource among all the processes. The scheduler is a component
of the O/S that determines which process to run at any given time and how long to let it run. The scheduler gives the
CPU to each process with highest priority for a brief period of time before switching to another process. This period is
called a time quantum or time slice. 5
The scheduler makes it possible to execute multiple programs at the same time, thus sharing the CPU with users
of varying needs. Each task has a time slice that determines how much time it is permitted to execute and utilize the
CPU resources. The first 100 priority lists of the run queue are reserved for real-time tasks, and the last 40 are used
5 Uresh Vahalia, UNIX Internals: The New Frontiers (Prentice Hall, 1996).
 
Search WWH ::




Custom Search