博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux oracle AIO实现
阅读量:2427 次
发布时间:2019-05-10

本文共 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 aio
libaio-devel-0.3.106-3.2
libaio-0.3.106-3.2
libaio-devel-0.3.106-3.2
libaio-0.3.106-3.2
libsane-hpaio-1.6.7-4.1.el5_2.4
[root@anpc ~]# cat /proc/slabinfo | grep kio
kioctx 64 96 320 12 1 : tunables 54 27 8 : slabdata 8 8 0
kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0
kiocb值的第二列和第三列非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-nr
2、检查软件是否开启AIO支持。
[oracle@anpc ~]$ /usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /usr/lib64/libaio.so.1 (0x00002aaaac4a9000)

如上面显示说明已经开启

[oracle@anpc ~]$ /usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_getevent
w io_getevents@@LIBAIO_0.4 如上面显示说明已经开启
10GR1以前版本需要手动开启AIO,relink一下。
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk async_on
make -f ins_rdbms.mk ioracle
关闭Oracle的异步功能支持
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk async_off
3、开启Oracle数据库AIO功能的支持。
SQL> alter system set filesystemio_options = setall scope=spfile;
SQL> alter system set disk_asynch_io = true scope=spfile;
SQL> shutdown immediate
SQL> startup
4、查看是否开启
[root@anpc ~]# cat /proc/slabinfo | grep kio
kioctx 64 96 320 12 1 : tunables 54 27 8 : slabdata 8 8 0
kiocb 15 15 256 15 1 : tunables 120 60 8 : slabdata 1 1 0
非零说明已经开启
[oracle@anpc ~]$ sqlplus / as sysdba
SQL> select count(*) from test01;
COUNT(*)
----------
8388608
SQL> set timing on
SQL> create test03 as select * from test01;
Table created.
Elapsed: 00:00:09.81
以前消耗的时间:
SQL> set timing on
SQL> create table test02 as select * from test01;
Table created.
Elapsed: 00:00:12.33
比较与更改前创建表的消耗时间缩短了有3秒。
至此完成测试以及调整。
E文说明:
Asynchronous I/O
With 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 bottlenecks

Some 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/

你可能感兴趣的文章
陈芳,高考之后我要学计算机专业,将来做 IT 发财了,我就娶你!
查看>>
“编程能力差的程序员,90%输在这事上!”谷歌AI专家:都是瞎努力!
查看>>
张一鸣做电商:再造一个“抖音”
查看>>
“你写的 Bug 让我来改好吗” | 每日趣闻
查看>>
大厂技术文档:Redis+Nginx+Spring全家桶+Dubbo精选
查看>>
笑死,别再黑程序员了好吗? | 每日趣闻
查看>>
Python 爬取 13966 条运维招聘信息,这些岗位最吃香
查看>>
28 岁退休程序员自述:不是富二代,行政专业出身,非典型程序员
查看>>
那时刚毕业的我,曾参与惊心动魄 3Q 大战
查看>>
程序员爬取 5000+ 口红商品数据,差点比女朋友更懂口红?
查看>>
30 张图解 | 高频面试知识点总结:面试官问我高并发服务模型哪家强?
查看>>
以太坊创始人V 神:普通人看见现在,天才看见未来
查看>>
厉害!从电影花瓶到 Wi-Fi 之母,这才是乘风破浪的姐姐!
查看>>
中国开源大爆发进行时,你没掉队吧?
查看>>
用 Python 实现抖音上的“人像动漫化”特效,原来这么简单!
查看>>
一周内咸鱼疯转 2.4W 次,最终被所有大厂封杀!
查看>>
关于鸿蒙 2.0,那些开发者不知道的一切
查看>>
Google 排名第一的语言,引数十万人关注:搞定它,技术大牛都甘拜下风
查看>>
JavaScript 爆红后,微软为何还要开发 TypeScript?
查看>>
软件开发行业,年轻与大龄程序员的生存现状
查看>>