设为首页 加入收藏

TOP

ORACLE数据库异步IO介绍(一)
2015-11-21 01:28:56 来源: 作者: 【 】 浏览:1
Tags:ORACLE 数据库 异步 介绍
异步IO概念
?
Linux 异步 I/O (AIO)是 Linux 内核中提供的一个增强的功能。它是Linux 2.6 版本内核的一个标准特性,当然我们在2.4 版本内核的补丁中也可以找到它。AIO 背后的基本思想是允许进程发起很多 I/O 操作,而不用阻塞或等待任何操作完成。稍后或在接收到 I/O 操作完成的通知时,进程就可以检索 I/O 操作的结果。
?
Linux IO模型(I/O models)分同步IO模型(synchronous models)和异步IO模型(asynchronous models)。 在同步IO中,线程启动一个IO操作然后就立即进入等待状态,直到IO操作完成后才醒来继续执行。而异步IO方式中,线程发送一个IO请求到内核,然后继续处理其他的事情,内核完成IO请求后,将会通知线程IO操作完成了
?
如果IO请求需要大量时间执行的话,异步文件IO方式可以显著提高效率,因为在线程等待的这段时间内,CPU将会调度其他线程进行执行,如果没有其他线程需要执行的话,这段时间将会浪费掉(可能会调度操作系统的零页线程)。如果IO请求操作很快,用异步IO方式反而还低效,还不如用同步IO方式。
?
异步IO好处
?
异步I/O的优点:异步I/O是和同步I/O相比较来说的,如果是同步I/O,当一个I/O操作执行时,应用程序必须等待,直到此I/O执行完。相反,异步I/O操作在后台运行,I/O操作和应用程序可以同时运行,提高了系统性能;使用异步I/O会提高I/O流量,如果应用是对裸设备进行操作,这种优势更加明显, 因此像 数据库,文件服务器等应用往往会利用异步I/O,使得多个I/O操作同时执行. 而且从官方文档来看,ORACLE也是推荐ORACLE数据库启用异步IO的这个功能的。
?
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.
?
Q: 2. What are the benefits of Asynchronous I/O?
?
A: The implementation of Asynchronous I/O on Red Hat Advanced Server allows Oracle processes to issue multiple I/O requests to disk with a single system call, rather than a large number of single I/O requests. This improves performance in two ways:
?
First, because a process can queue multiple requests for the kernel to handle, so the kernel can optimize disk activity by recording requests or combining individual requests that are adjacent on disk into fewer and larger requests.
Secondary, because the system does not put the process in sleep state while the hardware processes the request. So, the process is able to perform other tasks until the I/O complete.
This involves making use of I/O capabilities such as:
?
Asynchronous I/O: Asynchronous I/O does not reduce traffic but allows processes to do other things while waiting for IO to complete.
Direct I/O (bypassing the Operating System's File Caches) : Direct IO does not reduce traffic but may use a shorter code path / fewer CPU cycles to perform the IO.
?
启用异步IO
?
ORACLE数据库是从ORACLE 9i Release 2开始支持异步IO特性的。之前的版本是不支持异步IO特征的。另外在ORACLE 9i R2和 ORACLE 10g R1中默认是禁用异步特性的,直到ORACLE 10g R2才默认启用异步IO特性。
?
Q: 4. Can I use Asynchronous I/O with Oracle 8i or Oracle 9i release 1?
?
A: No. Asynchronous I/O feature is only available with Oracle RDBMS 9i release 2 (Oracle9iR2).
?
?
Q: 5. Is Asynchronous I/O active with Oracle RDBMS by default?
?
A: No. By default, Oracle9iR2 and Oracle10gR1 are shipped with asynchronous I/O support disabled.In 10gR2 asyncIO is enabled by default.
?
那么如何启用ORACLE数据库的异步IO特性呢? 我们可以按照下面步骤操作:
?
1:首先要确认ORACLE数据库所在的 系统平台(操作系统)是否支持异步IO
?
目前流行的 Linux/Unix平台基本上都支持异步IO,但是一些老旧的版本就不一定了。可以搜索一下相关文档了解清楚。
?
2: 检查是否安装libaio、libaio-devel相关包(似乎libaio-devel包不是必须的,测试环境没有libaio-devel似乎也OK,当然最好也一起安装)
?
[root@DB-Server ~]# rpm -qa | grep aio?
libaio-0.3.106-5
libaio-0.3.106-5
?
[root@DB-Server Server]# rpm -ivh libaio-devel-0.3.106-5.i386.rpm
warning: l
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇给结果集分页 下一篇linux安装oracle常见错误总结

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: