温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle 之 AIO (异步io)

发布时间:2020-08-11 17:42:05 来源:ITPUB博客 阅读:158 作者:张冲andy 栏目:关系型数据库



Linux 异步 I/O (AIO)是 Linux 内核中提供的一个增强的功能。它是Linux 2.6 版本内核的一个标准特性,AIO 背后的基本思想是允许进程发起很多 I/O 操作,而不用阻塞或等待任何操作完成。稍后或在接收到 I/O 操作完成的通知时,进程就可以检索 I/O 操作的结果。

同步IO:线程启动一个IO操作然后就立即进入等待状态,直到IO操作完成后才醒来继续执行。
异步IO:线程发送一个IO请求到内核,然后继续处理其他的事情,内核完成IO请求后,将会通知线程IO操作完成

补充:当后台等待事件排在第一的是 db file async I/O submit,这是一个异步IO相关的等待事件,可以考虑开启异步io。

1、--查看系统是否使用异步IO 。 slab是Linux的内存分配器,AIO相关的内存结构已经分配。
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、 查看数据库是否开启异步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.
在文件系统文件上启用异步I/O,在数据传送上没有计时要求。
DIRECTIO: enable direct I/O on file system files, which bypasses the buffer cache.
在文件系统文件上启用直接I/O,绕过buffer cache。
SETALL: enable both asynchronous and direct I/O on file system files.
在文件系统文件上启用异步和直接I/O。
NONE: disable both asynchronous and direct I/O on file system files.
在文件系统文件上禁用异步和直接I/O。

3、 oracle已经链接了aio的包
[oracle@localhost ~]$ /usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /lib64/libaio.so.1 (0x0000003e13000000)
说明:检查显示oracle已经链接了aio的包

4、 调整数据库参数 开启aio
数据库中的filesystemio_options参数设置为none,看来oracle中也没有配置异步IO,
这里可以将数据库中的filesystemio_options参数调整为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、 数据库层面查看是否开启异步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问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI