本文摘自PHP中文网,作者一个新手,侵删。
Linux 异步 I/O (AIO)是 Linux 内核中提供的一个增强的功能。它是Linux 2.6 版本内核的一个标准特性,AIO 背后的基本思想是允许进程发起很多 I/O 操作,而不用阻塞或等待任何操作完成。稍后或在接收到 I/O 操作完成的通知时,进程就可以检索 I/O 操作的结果。
同步IO:线程启动一个IO操作然后就立即进入等待状态,直到IO操作完成后才醒来继续执行。
异步IO:线程发送一个IO请求到内核,然后继续处理其他的事情,内核完成IO请求后,将会通知线程IO操作完成
1、--查看系统是否使用异步IO 。 slab是Linux的内存分配器,AIO相关的内存结构已经分配。
1 2 3 4 | 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
1 2 3 4 5 6 7 8 | (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
|
1 2 3 4 5 6 7 8 9 | 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的包
1 2 | [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;
1 2 3 4 | 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是否生效
1 2 3 | [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
|
补充:出现 free buffer waits 等待事件 或者 io不给力的时候, 可以考虑开启aio。
以上就是Oracle中AIO解析的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
oracle查询时间语句有哪些?
oracle 10g的dba无法登录解决方案
plsql和tsql常用函数比对
java下使用oracle存储过程(详解)
oracle 数据库特殊查询总结
一个oracle分页程序,挺实用的.
oracle删除重复数据保留第一条记录
oracle执行update语句的几种方式
oracle中plsql中if语句的写法介绍
oracle 遍历游标的四种方式汇总(for、fetch、while、bulk collect)
更多相关阅读请进入《oracle》频道 >>
机械工业出版社
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
转载请注明出处:木庄网络博客 » Oracle中AIO解析