How to use the _ use_adaptive_log_file_sync parameter in oralce

Source: Internet
Author: User
Tags ack commit oracle docs switches cpu usage high cpu usage

_ Use_adaptive_log_file_sync: in systems with a large number of commit operations, the post/wait and polling features have a significant impact on performance, mainly because the waiting time on log writing affects the transaction commit speed. we recommend that you disable it in 11g (set to false ).

This parameter can be described as follows:

Adaptive Log File sync was introduced in 11.2. the feature is exactly enabled since release 11.2.0.3, It's enabled through an underscore parameter called _ use_adaptive_log_file_sync and the description of this parameter is: adaptively switch between post/wait and polling.

Oracle can switches between the 2 methods:
Post/wait, traditional method for posting completion of writes to redo log

LGWR explicitly posts all processes waiting for the commit to complete.
The advantage of the post/wait method is that sessions shoshould find out almost immediately when the redo has been flushed to disk.

Polling, a new method where the foreground process checks if the LGWR has completed the write.

Foreground processes sleep and poll to see if the commit is complete. the advantage of this new method is to free LGWR from having to inform using processes waiting on commit to complete thereby freeing high CPU usage by the LGWR. if post/wait is selected and the foreground processes fail to receive a post from LGWR, an incident is recorded. diagnostic traces are saved Med, and polling is used instead of post/wait.

Oracle uses semaphores extensively, If you look for references to "commit" in the Oracle docs, you'll find the word "post" everywhere when they talk about communication between the foreground processes and LGWR. now, remember that a COMMIT has two options: first, IMMEDIATE or BATCH and second, WAIT or NOWAIT. it looks like this to me:

Immediate: FG process will post to LGWR, triggering I/O (default)
Batch: FG process will not post LGWR
Wait: LGWR will post FG process when I/O is complete (default)
NoWait: LGWR will not post FG process when I/O is complete

There are five more hidden parameters with that string

Select a. ksppinm name, B. ksppstvl value, a. ksppdesc description
From sys. x $ ksppi a, sys. x $ ksppcv B
Where a. indx = B. indx and a. ksppinm like '\ _ % adaptive \ _ log % 'escape '\'
Order by name;

Sys @ ANBOB>/

NAME VALUE DESCRIPTION
---------------------------------------------
_ Adaptive_log_file_sync_high_switch_freq_threshold 3 Threshold for frequent log file sync mode switches (per minute)
_ Adaptive_log_file_sync_poll_aggressiveness 0 Polling interval selection bias (conservative = 0, aggressive = 100)
_ Adaptive_log_file_sync_sched_delay_window 60 Window (in seconds) for measuring average scheduling delay
_ Adaptive_log_file_sync_use_polling_threshold 200 Ratio of redo synch time to expected poll time as a percentage
_ Adaptive_log_file_sync_use_postwait_threshold 50 Percentage of foreground load from when post/wait was last used
_ Use_adaptive_log_file_sync TRUE Adaptively switch between post/wait and polling

So how do you know if you're using this feature? The most obvious sign will be in the LGWR trace file.
There will be messages each time that a switch happens, looking something like this:
In the case my db name and instance name both is kaoshi.

[Oracle @ anbob trace] $ pwd
/Oracle/diag/rdbms/kaoshi/trace

[Oracle @ anbob trace] $ grep-n-B 4 "kcrfw_update_adaptive_sync_mode" * _ lgwr _*

Adaptive Switching Between Log Write Methods can Cause 'log file sync' Waits (Document ID 1462942.1)
-
Kaoshi_lgwr_3823.trc-147-*** 12:06:23. 288
Kaoshi_lgwr_3823.trc-148-Log file sync switching to polling
Kaoshi_lgwr_3823.trc-149-Current scheduling delay is 1 usec.
Kaoshi_lgwr_3823.trc-150-Current approximate redo synch write rate is 30 per sec.
Kaoshi_lgwr_3823.trc: 151: Pushed: poll-> post current_sched_delay = 0 switch_sched_delay = 1 current_sync_count_delta = 0 switch_sync_count_delta = 90
Kaoshi_lgwr_3823.trc-152-
Kaoshi_lgwr_3823.trc-153-*** 12:56:23. 567
Kaoshi_lgwr_3823.trc-154-Log file sync switching to post/wait
Kaoshi_lgwr_3823.trc-155-Current approximate redo synch write rate is 0 per sec.
Kaoshi_lgwr_3823.trc: 156: kcrfw_update_adaptive_sync_mode: post-> poll long # = 36 sync # = 131 sync = 390 poll = 1058 rw = 217 ack = 0 min_sleep = 1058
-
Kaoshi_lgwr_3823.trc-160-Current scheduling delay is 1 usec.
Kaoshi_lgwr_3823.trc-161-Current approximate redo synch write rate is 43 per sec.
Kaoshi_lgwr_3823.trc-162-
Kaoshi_lgwr_3823.trc-163-*** 14:37:46. 978
Kaoshi_lgwr_3823.trc: 164: Pushed: poll-> post current_sched_delay = 0 switch_sched_delay = 1 current_sync_count_delta = 25 switch_sync_count_delta = 131
Kaoshi_lgwr_3823.trc-165-
Kaoshi_lgwr_3823.trc-166-*** 14:37:46. 978
Kaoshi_lgwr_3823.trc-167-Log file sync switching to post/wait
Kaoshi_lgwr_3823.trc-168-Current approximate redo synch write rate is 8 per sec.
Kaoshi_lgwr_3823.trc: 169: kcrfw_update_adaptive_sync_mode: post-> poll long # = 86 sync # = 121 sync = 2 poll = 1058 rw = 152 ack = 0 min_sleep = 1058
Disable adaptive log file sync

If there is a need to disable adaptive log file sync this can be done by setting _ use_adaptive_log_file_sync = false either in the spfile and restarting the database or dynamically in memory.

"_ Use_adaptive_log_file_sync" is a dynamic parameter that can be changed at system level.

Alter system set "_ use_adaptive_log_file_sync" = false;
Known Issues with "_ use_adaptive_log_file_sync" set to TRUE

See the following logs Ents with information on bugs involving Adaptive Log File Sync:
Document 1462942.1 Adaptive Switching Between Log Write Methods can Cause 'log file sync' Waits
Document 13707904.8 Bug 13707904-LGWR sometimes uses polling, sometimes post/wait
Document 13074706.8 Bug 13074706-Long "log file sync" waits in RAC not correlated with slow writes

References
Waits for "log file sync" with Adaptive Polling vs Post/Wait Choice Enabled (Document ID 1541136.1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.