本文共 2868 字,大约阅读时间需要 9 分钟。
这篇文章介绍了linux 下 oracle AIO实现,对于性能提高还是很有帮助
[@more@]一直知道异步IO的存在,未有深入研究已经和测试过,偶然搜索到一些博主的文章,发现文章写的比较齐全,就大概整理了一下文章,并做了简单的测试来共享,如果你的系统遇到写问题或者想改善一下IO的效率,可以考虑一下异步IO的使用,尤其对使用裸设备的提升最为明显。
介绍: 异步 I/O 是 Linux 内核中提供的一个相当新的增强。它是 2.6 版本内核的一个标准特性,但是我们在 2.4版本内核的补丁中也可以找到它。 背后的基本思想是允许进程发起很多 I/O 操作,而不用阻塞或等待任何操作完成。稍后或在接收到 I/O 操作完成的通知时,进程就可以检索 I/O 操作的结果。效果:使用异步 I/O 大大提高应用程序的性能.AIO = asynchronous IO
1、检查linux相关包[root@anpc ~]# rpm -qa | grep aiolibaio-devel-0.3.106-3.2libaio-0.3.106-3.2libaio-devel-0.3.106-3.2libaio-0.3.106-3.2libsane-hpaio-1.6.7-4.1.el5_2.4[root@anpc ~]# cat /proc/slabinfo | grep kiokioctx 64 96 320 12 1 : tunables 54 27 8 : slabdata 8 8 0kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0kiocb值的第二列和第三列非0即是已使用。The kioctx and kiocb are Async I/O structures that are defined in aio.h.If it shows a non zero value that means async io is enabled.source code loaded /usr/src/linux-/include/linux/aio.h从2.6 kernel开始,已经取消了对IO size的限制,Oracle建议将aio-max-nr的值设置为1048576或更高。[root@anpc ~]# echo 1048576 > /proc/sys/fs/aio-max-nr2、检查软件是否开启AIO支持。[oracle@anpc ~]$ /usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaiolibaio.so.1 => /usr/lib64/libaio.so.1 (0x00002aaaac4a9000)如上面显示说明已经开启
[oracle@anpc ~]$ /usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_geteventw io_getevents@@LIBAIO_0.4 如上面显示说明已经开启10GR1以前版本需要手动开启AIO,relink一下。cd $ORACLE_HOME/rdbms/libmake -f ins_rdbms.mk async_onmake -f ins_rdbms.mk ioracle关闭Oracle的异步功能支持cd $ORACLE_HOME/rdbms/libmake -f ins_rdbms.mk async_off3、开启Oracle数据库AIO功能的支持。SQL> alter system set filesystemio_options = setall scope=spfile;SQL> alter system set disk_asynch_io = true scope=spfile;SQL> shutdown immediateSQL> startup4、查看是否开启[root@anpc ~]# cat /proc/slabinfo | grep kiokioctx 64 96 320 12 1 : tunables 54 27 8 : slabdata 8 8 0kiocb 15 15 256 15 1 : tunables 120 60 8 : slabdata 1 1 0非零说明已经开启[oracle@anpc ~]$ sqlplus / as sysdbaSQL> select count(*) from test01; COUNT(*)---------- 8388608SQL> set timing onSQL> create test03 as select * from test01;Table created.Elapsed: 00:00:09.81以前消耗的时间:SQL> set timing onSQL> create table test02 as select * from test01;Table created.Elapsed: 00:00:12.33比较与更改前创建表的消耗时间缩短了有3秒。至此完成测试以及调整。E文说明:Asynchronous I/OWith synchronous I/O, when an I/O request is submitted to the operating system,the writing process blocks until the write is confirmed as complete. It can then continue processing.With asynchronous I/O, processing continues while the I/O request is submitted and processed.Use asynchronous I/O when possible to avoid bottlenecksSome platforms support asynchronous I/O by default, others need special configuration,
and some only support asynchronous I/O for certain underlying file system types.来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7916042/viewspace-1057594/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7916042/viewspace-1057594/