溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle 之 AIO (異步io)

發(fā)布時間:2020-08-11 17:42:05 來源:ITPUB博客 閱讀:162 作者:張沖andy 欄目:關系型數(shù)據(jù)庫



Linux 異步 I/O (AIO)是 Linux 內(nèi)核中提供的一個增強的功能。它是Linux 2.6 版本內(nèi)核的一個標準特性,AIO 背后的基本思想是允許進程發(fā)起很多 I/O 操作,而不用阻塞或等待任何操作完成。稍后或在接收到 I/O 操作完成的通知時,進程就可以檢索 I/O 操作的結果。

同步IO:線程啟動一個IO操作然后就立即進入等待狀態(tài),直到IO操作完成后才醒來繼續(xù)執(zhí)行。
異步IO:線程發(fā)送一個IO請求到內(nèi)核,然后繼續(xù)處理其他的事情,內(nèi)核完成IO請求后,將會通知線程IO操作完成

補充:當后臺等待事件排在第一的是 db file async I/O submit,這是一個異步IO相關的等待事件,可以考慮開啟異步io。

1、--查看系統(tǒng)是否使用異步IO 。 slab是Linux的內(nèi)存分配器,AIO相關的內(nèi)存結構已經(jīng)分配。
more /proc/slabinfo |grep kio
[root@localhost ~]# grep kio /proc/slabinfo
kioctx 0 0 384 10 1 : tunables 54 27 0 : slabdata 0 0 0
kiocb 0 0 256 15 1 : tunables 120 60 0 : slabdata 0 0 0
看到kiocb行顯示為0,說明異步IO沒有啟動。

2、 查看數(shù)據(jù)庫是否開啟異步io
(11G)SYS@qixindb> show parameter disk_asynch_io
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
disk_asynch_io boolean TRUE

(11G)SYS@qixindb> show parameter filesystem
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
filesystemio_options string none

filesystemio_options 的四種值:
ASYNCH: enable asynchronous I/O on file system files, which has no timing requirement for transmission.
在文件系統(tǒng)文件上啟用異步I/O,在數(shù)據(jù)傳送上沒有計時要求。
DIRECTIO: enable direct I/O on file system files, which bypasses the buffer cache.
在文件系統(tǒng)文件上啟用直接I/O,繞過buffer cache。
SETALL: enable both asynchronous and direct I/O on file system files.
在文件系統(tǒng)文件上啟用異步和直接I/O。
NONE: disable both asynchronous and direct I/O on file system files.
在文件系統(tǒng)文件上禁用異步和直接I/O。

3、 oracle已經(jīng)鏈接了aio的包
[oracle@localhost ~]$ /usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /lib64/libaio.so.1 (0x0000003e13000000)
說明:檢查顯示oracle已經(jīng)鏈接了aio的包

4、 調(diào)整數(shù)據(jù)庫參數(shù) 開啟aio
數(shù)據(jù)庫中的filesystemio_options參數(shù)設置為none,看來oracle中也沒有配置異步IO,
這里可以將數(shù)據(jù)庫中的filesystemio_options參數(shù)調(diào)整為setall;

SQL> alter system set filesystemio_options = setall scope=spfile; 
SQL> alter system set disk_asynch_io = true scope=spfile; 
SQL> shutdown immediate;
SQL> startup;

5、查看aio是否生效
[oracle@localhost ~]$ more /proc/slabinfo |grep kio
kioctx 130 160 384 10 1 : tunables 54 27 8 : slabdata 16 16 0
kiocb 16 30 256 15 1 : tunables 120 60 8 : slabdata 2 2 1

6、 數(shù)據(jù)庫層面查看是否開啟異步io
select name, asynch_io
from v$datafile f, v$iostat_file i
where f.file# = i.file_no
and (filetype_name = 'Data File' or filetype_name = 'Temp File');

 


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI