Tuning for Oracle Log Buffer Space Waits

7
Tuning for Oracle Log Buffer Space Waits Confio Software 08/26/2022 1

description

When processes wait on the Log Buffer Space event, the SQL Server log buffer is filling up faster than what the LGWR process can write to disk. If this wait event is frequent, throughput is reduced for the entire database. While increasing the log buffer size is an option, it should be done after careful consideration.

Transcript of Tuning for Oracle Log Buffer Space Waits

Page 1: Tuning for Oracle Log Buffer Space Waits

04/13/2023 1

Tuning for Oracle Log Buffer Space Waits

Confio Software

Page 2: Tuning for Oracle Log Buffer Space Waits

04/13/2023 2

Tuning for Oracle Log Buffer Space Waits—Part 1

• Log Buffer Space waits occur when server processes write data into the log buffer faster than the LGWR process can write it out

• The LGWR process begins writing entries to the online redo log file if any of the following are true:– The log buffer reaches the _log_io_size threshold– By default, this parameter is set to 1/3 the log buffer size– A server process performing a COMMIT o ROLLBACK

posts to the LGWR process– DBWR process posts to the LGWR process before it

begins writing

Page 3: Tuning for Oracle Log Buffer Space Waits

04/13/2023 3

Tuning for Oracle Log Buffer Space Waits—Part 2

• As the LGWR process writes entries to disk, user processes can reuse the space in the log buffer for new entries

• If the Log Buffer is too small, user processes wait for Log Buffer Space until the LGWR flushes the redo information in memory to disk

Page 4: Tuning for Oracle Log Buffer Space Waits

04/13/2023 4

About the Redo Log Buffer Size

• Size of Redo Log Buffer controlled by the LOG_BUFFER initialization parameter – Expressed in bytes– Oracle's default setting for LOG_BUFFER is the

maximum size of 512k (.5m) or (128k * # of CPUs– Most of the time, the default setting is appropriate

• If applications insert, update or delete large amounts of data and user processes experience many Log Buffer Space waits:– Consider increasing the LOG_BUFFER parameter (see

note on next slide first!)

Page 5: Tuning for Oracle Log Buffer Space Waits

04/13/2023 5

Be Careful If Changing the LOG_BUFFER Parameter

• When processes wait on the Log Buffer Space event, the log buffer is filling up faster than what the LGWR process can write to disk. – If this wait event is frequent, throughput is reduced for the entire database. Consider increasing

the LOG_BUFFER to an optimal size.• Important! Perform careful analysis before changing this parameter:

– A LOG_BUFFER sized too large will cause the _log_io_size threshold also to be large– This may cause the LGWR process to write more data less often, causing the Oracle wait event

Log File Sync• For example, a LOG_BUFFER size of 10m will result in a _log_io_size threshold of over 3m

– LGWR process will not begin writing until the 3m threshold is met, a checkpoint happens, or a commit or rollback is issued

– If a commit or rollback is issued, the LGWR may take longer to write all the data from the buffer (up to last commit mark), especially if it hasn't yet reached the larger 3m threshold.

– The larger write at commit time will result in individual processes waiting on the log file sync event.

– The log file sync wait event occurs when processes commit or rollback, then wait for the information to be flushed from the log buffer (memory) to the online redo log file (disk).

• When changing the LOG_BUFFER parameter, the optimal size should reduce the number of log-related wait events, not increase them!

Page 6: Tuning for Oracle Log Buffer Space Waits

04/13/2023 6

Other Tuning Considerations

• When sizing the LOG_BUFFER produces no additional benefit, consider other tuning opportunities to reduce the Log Buffer Space wait event:– Poor I/O performance

• The Log Buffer Space wait could indicate slow disks and/or slow log file switches. • Investigate moving the log files to faster disks such as file system direct I/O or raw devices. • Look at improving the checkpointing or archiving process for better overall throughput.

– Application design• If the application performs many commits or has heavy logging activity, try reducing the

activity by using the NOLOGGING option where appropriate. • Look for poor application behavior, such as, fetching and updating all columns in a table

when only a few columns need changed.

– Materialized views• Verify that appropriate methods of refresh have been chosen. • If possible, perform fast refreshes instead of complete refreshes. • If using 10g and performing complete refreshes, review the setting of the ATOMIC_REFRESH

parameter on the refresh statement. In 10g, the default changed to DELETE FROM the materialized view (causing redo creation) instead of using the TRUNCATE command (a nologging operation). For further details on this setting, see Metalink Note 306502.1.

Page 7: Tuning for Oracle Log Buffer Space Waits

04/13/2023 7

Find Root Cause of Waits Quickly with Confio Ignite

• Improve database performance by 65% with Confio Ignite– Identify bottlenecks and root causes of waits like

these in minutes– Installs in minutes– Puts no load on monitored servers

Download Ignite trial for freewww.confio.com/freetrial