HOW TO CHECK IF ASYNCHRONOUS I/O IS WORKING ON LINUX轉自http://sundog315.itpub.net/

本文介绍如何在Linux环境下配置并验证Oracle数据库的异步I/O (AIO) 功能。通过设置参数和检查内核结构来确认AIO是否启用,并提供了不同版本Linux和Oracle的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PURPOSE ------- In this document we are going to explain how to check that asynchronous I/O (AIO) is working. AIO can be enabled in Oracle 9i 9.2 and higher. SCOPE & APPLICATION ------------------- Many times there is a requirement to check if Asynchronous I/O is working on Linux Platform, so we can try to use it for our datafiles access inside database. SOLUTION -------- slabinfo maintains statistics about objects in memory. Some of the structs used by Asynchronous I/O are threated as objects in the virtual memory, so we can look for those structs on slabinfo. The ones related to AIO are named kio*. $ cat /proc/slabinfo | grep kio for example: output with async io enabled. $ cat /proc/slabinfo | grep kio kioctx 270 270 128 9 9 1 : 252 126 kiocb 66080 66080 96 1652 1652 1 : 252 126 kiobuf 236 236 64 4 4 1 : 252 126 $ output with async io disabled. $ cat /proc/slabinfo | grep kio kioctx 0 0 128 0 0 1 : 252 126 kiocb 0 0 96 0 0 1 : 252 126 kiobuf 0 0 64 0 0 1 : 252 126 $ There are 3 caches involved. The kioctx and kiocb are Async I/O data structures that are defined in aio.h. If it shows a non zero value that means async io is enabled. If you have the source code loaded, you can review it at file aio.h. This file is located under: /usr/src/linux-/include/linux/aio.h These data structures are using to track the I/O requests, and are allocated as part of the __init_aio_setup() call in aio.c. Example strace of dbw0 process with AIO enabled (init.ora parameter filesystemio_options = asynch) shows: io_submit(3071864832, 1, {{0xb7302e34, 0, 1, 0, 21}}) = 1 gettimeofday({1176916625, 58882}, NULL) = 0 io_getevents(-1223102464, 1, 1024, {{0xb7302e34, 0xb7302e34, 8192, 0}}, {600, 0}) = 1 Example strace of dbw0 process with AIO disabled (filesystemio_options = none): pwrite64(21, "624200421300220B243162073571"..., 8192, 36077568) = 8192 times(NULL) = 1775653082 times(NULL) = 1775653082 pwrite64(21, "6242<21300220B243162542*"..., 8192, 36143104) = 8192 CAVEAT FOR ASMLib ----------------- If Oracle ASMLib (see http://oss.oracle.com/projects/oracleasm ) is deployed, the kiocb structs are not used. ASMLib does not use the POSIX aio_*() functions. You will never see any kioctx or kiocb structures from ASMLib. It is far lower level than that. In fact, ASMLib does AIO or SyncIO depending on how the I/O is passed to it, It makes no decisions at all. This is entirely up to kfk and the layers above it, kfk is entirely controlled by the disk_asynch_io parameter. So, we can check whether ASMLib is doing AIO by PL/SQL command "show param disk_asynch_io". (You can disable AIO by set disk_asynch_io=false) With ASMLib, AIO is done via ioctl() calls (2.4 kernel), or read() calls (2.6 kernel) on the ASM device. Whether ASMLib uses aio depends on whether oracle is configured to do aio, In oracle 10g, if ASMLib is in use, the i/o is asynchronous, because oracle 10g enables aio by default. The strace when using ASMlib will show read calls that look like this: read(16, "MSA210P222377377377@3133735"..., 80) = 80 The first 3 characters, byte-swapped, are ASM, indicating an ASMLib I/O command structure. sundog315 发表于:2007.09.10 10:13 ::分类: ( Oracle ) ::阅读:(648次) :: 评论 (0) Asynchronous I/O (aio) on RedHat Applies to: Linux Kernel - Version: Linux x86 Purpose Give the most frequent question and answer about Asynchronous I/O. Questions and Answers Q: 1. What is a Asynchronous I/O? A: One of the most important enhancements on Red Hat Advanced Server since Oracle RDBMS 9.2 is asynchronous I/O (or nonblocking I/O) in the kernel. Before the introduction of asynchronous I/O in Advanced Server, processes submitted disk I/O requests sequentially. Each I/O request would cause the calling process to sleep until the request was completed. Asynchronous I/O allows a process to submit an I/O request without waiting for it to complete. [top] 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. [top] Q: 3. Is the Asynchronous I/O available on all Linux Distributions? A: Asynchronous I/O feature is only available on Red Hat Advanced Server release or on UnitedLinux / SUSE and not on other Linux platforms. [top] 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). [top] 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. [top] Q: 6. How can I enable the Asynchronous I/O? A: To enable asynchronous I/O for Oracle9iR2 on Red Hat Linux Advanced Server 2.1 and on RHEL 3.0 (see also Q: 15.What need to do using Red Hat Enterprise Linux (RHEL) 3.0?), You will need to follow these steps as outlined in the product documentation: 1) cd to $ORACLE_HOME/rdbms/lib a) make -f ins_rdbms.mk async_on b) make -f ins_rdbms.mk ioracle 2) Parameter setting Parameter settings in init.ora for raw devices: set 'disk_asynch_io=true' (default value is true) Parameter settings in init.ora file for filesystem files: Make sure that all Oracle datafiles reside on filesystems that support asynchronous I/O. (For example, ext2, ext3) a) set 'disk_asynch_io=true' (default value is true) b) set 'filesystemio_options=asynch' For 10g database you require following to async io to work. 1) In RHEL 2.1 1. Requires libaio packages. libaio-0.3.13-3.i386.rpm libaio-devel-0.3.13-3.i386.rpm 2. By default async io is not enabled in oracle binary. Therefore you need to relink oracle as follows for async io. Also look at Note 270213.1 & Bug 3438751. make PL_ORALIBS=-laio -f ins_rdbms.mk async_on 3. In init.ora file add following option. for raw devices: disk_asynch_io=true (this is default option) for file system: filesystemio_options =asynch disk_asynch_io=true (this is default option) 2) In RHEL 3 1. Requires libaio packages. (RHEL 3 Update 2) libaio-0.3.96-3.i386.rpm libaio-devel-0.3.96-3.i386.rpm 2. By default async io is not enabled in oracle binary. Therefore you need to relink oracle as follows for async io. Also look at Note 270213.1 & [@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/779728/viewspace-1020691/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/779728/viewspace-1020691/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值