1. 程式人生 > >引數 _use_adaptive_log_file_sync

引數 _use_adaptive_log_file_sync

The parameter “_use_adaptive_log_file_sync” was introduced in 11gR2 and controls whether adaptive switching between post/wait and polling is enabled.
In 11.2.0.1 and 11.2.0.2 the default value for the parameter is false. From 11.2.0.3, the default value has been changed to true.

ORACLE從11gR2開始,oracle寫日誌引入了polling機制,在此之前只有post/wait機制。為了能在兩個機制之間進行自適應切換,引入了一個隱含引數"useadaptivelogfilesync"。在11.2.0.3之前,引數的預設值為false,僅啟用post/wait機制。從11.2.0.3開始,預設值為true,即lgwr程序在寫出日誌時會選擇在post/wait機制和polling機制進行自適應切換。

There are 2 methods by which LGWR and foreground processes can communicate in order to acknowledge that a commit has completed:
Post/wait - traditional method available in previous Oracle releases
LGWR explicitly posts all processes waiting for the commit to complete.
The advantage of the post/wait method is that sessions should find out almost immediately when the redo has been flushed to disk.
Polling
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 many processes waiting on commit to complete thereby freeing high CPU usage by the LGWR.

Post/wait進位制下,lgwr程序在將日誌寫入磁碟後,會立刻通知前臺程序,log file sync等待時間相對較短,但因12C以下oracle資料庫中的lgwr程序只有1個,大併發的commit會導致lgwr程序非常繁忙,cpu居高不下。lgwr與其他程序相比,更可能成為資料庫的效能瓶頸。

Polling模式下,lgwr程序執行寫入操作後不再單獨通知前臺程序寫已經完成,前臺程序使用定時查詢的方式對寫出的進度進行檢查。優點是LGWR不必通知等待提交完成的許多程序,從而釋放LGWR的高CPU使用率,但是會使前臺程序長時間處於log file sync等待。對於交易型的系統該引數應設定為false。

啟用該特性會在awr中看到redo synch poll writes、redo synch polls相關的資料不為0。同時,在lgwr的trace檔案中能看到Log file sync switching to post/wait、Log file sync switching to polling等相關資訊。

關閉方法:

ALTER SYSTEM SET "_use_adaptive_log_file_sync"= <FALSE/TRUE>  scope=<both/spfile/memory>;

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
Document 1541136.1 Adaptive Log File Sync Optimization