Oracle and Linux AsyncIO Parameter

简单的了解一下异步IO(asynchronous IO),在一个程序中如果涉及到磁盘的IO操作时,有两种情况
1. 程序等待IO操作完成,CPU再接下来处理程序的其他部分(等待IO的时间段内,CPU处于Idle Waiting状态)。
2. 程序不等待IO操作完成,允许CPU处理接下来的其他任务(或者理解为允许CPU处理接下来的不依赖于IO完成的任务)。
显然,第一种情况,CPU的资源白白的浪费了,也就是同步IO。第二种情况更有利于CPU的充分利用,这就是异步IO。

系统级 : 
Linux 参数包含如下,有系统内核参数可以用来调整异步IO的大小,aio-nr不需要调整,反映当前系统的异步IO情况,需要调整的是aio-max-nr参数。
aio-nr & aio-max-nr:

aio-nr shows the current system-wide number of asynchronous io requests.  

aio-nr is the running total of the number of events specified on the io_setup system call for all currently active aio contexts.  
If aio-nr reaches aio-max-nr then io_setup will fail with EAGAIN.  
Note that raising aio-max-nr does not result in the pre-allocation or re-sizing of any kernel data structures.

aio-max-nr allows you to change the maximum value aio-nr can grow to.
例如:
[root@db-192-168-101-35 Documentation]# sysctl -a|grep aio
fs.aio-max-nr = 1048576
fs.aio-nr = 0
可以看出当前系统的最大允许的异步IO=1MB. 
RHEL5.5默认是64KB

数据库级 :
Oracle(最左边是默认值) : 
DISK_ASYNCH_IO = true | false
是否使用操作系统的异步IO,默认为启用。如果不启用的话,可以设置DBWR_IO_SLAVES,让ORACLE自己来模拟异步IO。

DBWR_IO_SLAVES = 0 to operating system-dependent
是否开启ORACLE模拟异步IO的操作,默认=0,不开启。仅当DISK_ASYNCH_IO=flase时才需要修改这个参数。

FILESYSTEMIO_OPTIONS = { none | setall | directIO | asynch }
文件系统的IO选项,默认为NONE,这个参数貌似不设置也不会影响系统级别的异步IO,但是有些DBA还是比较喜欢把这个设置为setall。
directIO表示绕过文件系统的缓存。asynch表示启用文件系统的异步IO。

DBWR_IO_SLAVES模拟异步IO介绍 : 
DBWR_IO_SLAVES is relevant only on systems with only one database writer process (DBW0). It specifies the number of I/O server processes used by the DBW0 process. The DBW0 process and its server processes always write to disk. By default, the value is 0 and I/O server processes are not used.

If you set DBWR_IO_SLAVES to a nonzero value, the number of I/O server processes used by the ARCH and LGWR processes is set to 4. However, the number of I/O server processes used by Recovery Manager is set to 4 only if asynchronous I/O is disabled (either your platform does not support asynchronous I/O or disk_asynch_io is set to false).

Typically, I/O server processes are used to simulate asynchronous I/O on platforms that do not support asynchronous I/O or that implement it inefficiently. However, you can use I/O server processes even when asynchronous I/O is being used. In that case the I/O server processes will use asynchronous I/O.

I/O server processes are also useful in database environments with very large I/O throughput, even if asynchronous I/O is enabled.


参考 : 
http://en.wikipedia.org/wiki/Asynchronous_I/O
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值