Oracle 之 AIO (异步io) for Linux&AIX

mac2024-01-31  37

Oracle 之 AIO (异步io)

采用文件系统存放数据库文件,需要注意 AIO的配置。

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');

来自;https://www.cnblogs.com/andy6/p/7492016.html、

 

============= AIO For AIX

步骤1--获取CPU个数

# vmstat

 

步骤2—查看异步IO的配置

# ioo -F -a|grep aio

aio_active = 1

aio_maxreqs =4096   #最大请求数

aio_maxservers = 10     #每个cpu的aio的最大服务数

aio_minservers = 3      #每个cpu的aio的最小服务数

 

步骤3—查看异步IO的maxgc:

如果maxgc长时间处于超过CPU个数*aio_maxservers的状态,则说明IO可能有严重性能问题,需要对异步IO配置做出调整!

from; http://www.itpub.net/thread-2090703-1-1.html

最新回复(0)