Archive

Posts Tagged ‘aio’

AIX 5.2提供两种类型的AIO简介

March 4th, 2009 No comments

AIX 5.2提供了两种不同类型的异步IO(AIO)核心扩展函数(Kernel Extension),即AIX传统的AIO和POSIX 标准的AIO。

  虽然两种类型的AIO函数名称相同,但在aio.h中作了重新定义,以便两种函数均可使用libc.a 函数库。POSIX AIO也能通过librt.a调用。POSIX AIO 是编译时使用的默认选项。如需使用AIX传统的AIO,可通过新增加的宏定义_AIO_AIX_SOURCE完成。

  例如,使用POSIX AIO之前先将其加载:
  mkdev -l posix_aio

  使用POSIX AIO的应用程式需包含aio.h文件:
  #include <sys/aio.h>

  又如,使用AIX传统的 AIO之前需将其加载:
  mkdev -l aio

  使用AIX传统的 AIO的应用程式需包含下列定义:
  #define _AIO_AIX_SOURCE
  #include <sys/aio.h>
  或在编译命令行加入:
  xlc … -D_AIO_AIX_SOURCE … legacy_aio_program.c

  如果需要将POSIX AIO 核心扩展函数库在系统启动时自动加载,可用:smit chgposixaio将菜单中的选项”State to be configured at system restart” 由 “defined”改为 “available”,按下回车键后即可生效。

  对于AIX传统的AIO,可通过smit chgaio以相同方法修改菜单中的选项。
  

Categories: aio, oracle Tags:

AIX上如何配置异步IO

March 4th, 2009 No comments

AIX的异步IO需要bos.rte.aio文件集的支持

#lslpp -l bos.rte.aio
  Fileset                      Level  State      Description         
  —————————————————————————-
Path: /usr/lib/objrepos
  bos.rte.aio               5.3.0.62  COMMITTED  Asynchronous I/O Extension

如何启用AIO

#mkdev -l aio0
aio0 Available

#chdev -P -l aio0 -a autoconfig=’available’
aio0 changed

 

查看aio的配置信息

#lsattr -El aio0
autoconfig available STATE to be configured at system restart True
fastpath   enable    State of fast path                       True
kprocprio  39        Server PRIORITY                          True
maxreqs    4096      Maximum number of REQUESTS               True
maxservers 10        MAXIMUM number of servers per cpu        True
minservers 1         MINIMUM number of servers                True

其中,maxreqs表示同一时刻所允许的异步 I/O 请求,包括已经在处理的异步 I/O 请求和等待处理的异步 I/O 请求。maxservers和minservers参数指定了用于处理异步IO的进程数。默认的maxservers=10对于大多数系统来说,应该已经足够了,这两个参数都是针对文件系统等的aio的,而raw设备的异步IO直接由内核进程完成,不依赖aioserver。autoconfig必须设置为available才会在下次启动时自动激活AIO。

通过如下命令可以查询系统当前aioserver的个数,如果已经达到或者接近maxservers,则需要考虑增加该参数。

#pstat -a | grep aios | wc -l

从AIX5.2开始,支持两种模式的AIO,一种是传统模式的,一种是posix的

#pstat -a | grep aio
 40 a   28088      1  28088     0     0     1  posix_aioserver 
 67 a   43002      1  43002     0     0     1  aioserver

Oracle在AIX平台上安装的时候要求必须开启AIO,在rootpre.sh脚本中包含了启动AIO的代码

# Asynchronous I/O
echo “Configuring Asynchronous I/O…” | tee -a $LOG
    aio=`lsdev -C -t aio|awk ‘{print $2}’`
    case $aio in
      *Available*) echo “Asynchronous I/O is already defined” | tee -a $LOG
                   ;;
      *Defined*)   mkdev -l aio0 | tee -a $LOG
                   chdev -P -l aio0 -a autoconfig=’available’
                   ;;
      *)   echo “Asynchronous I/O is not installed on this system.” >> $LOG
           cat << END

Asynchronous I/O is not installed on this system.

You will need to install it, and either configure it yourself using
‘smit aio’ or rerun the Oracle root installation procedure.
END
                ;;
    esac

如何删除AIO

AIO是由内核提供支持的,首先将autoconfig改为defined然后重启系统

#chdev -P -l aio0 -a autoconfig=’defined’

如果使用rmdev -dl aio0彻底删除了aio0的定义,则再次使用mkdev -l aio0的时候可能遭遇以下错误:

mkdev: 0514-519 The following device was not found in the customized
        device configuration database:
        name = ‘aio0′

这时需要先定义设备,才能添加设备,定义aio0设备可以通过smit aio选择Configure Defined Asynchronous I/O。

另外要提到的一点,就是Oracle的存储测试工具Orion,也是必须打开AIO的,否则会报如下错误:

exec(): 0509-036 Cannot load program ./orion because of the following errors:
        0509-130 Symbol resolution failed for /usr/lib/libc.a[aio_64.o] because:
        0509-136   Symbol kaio_rdwr64 (number 0) is not exported from
                   dependent module /unix.
        0509-136   Symbol listio64 (number 1) is not exported from
                   dependent module /unix.
        0509-136   Symbol acancel64 (number 2) is not exported from
                   dependent module /unix.
        0509-136   Symbol iosuspend64 (number 3) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait (number 4) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait64 (number 5) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait_timeout (number 6) is not exported from
                   dependent module /unix.
        0509-136   Symbol aio_nwait_timeout64 (number 7) is not exported from
                   dependent module /unix.
        0509-026 System error: Error 0
        0509-192 Examine .loader section symbols with the
                 ‘dump -Tv’ command.
Categories: aio, oracle Tags:

Redhat Linux上Oracle如何启用AIO

March 4th, 2009 No comments

从Oracle9iR2开始支持Linux上的异步IO,但是Oracle9iR2和Oracle10gR1中的AIO模块默认是disable的,如果要启用必须relink一下

cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk async_on
make -f ins_rdbms.mk ioracle

当然,如果要关闭AIO支持,只需要使用async_off选项进行relink即可。在Oracle10gR2中AIO默认已经是开启的了。可以通过ldd或者nm来检查oracle是否已经启用了AIO支持,有输出代表已经启用

/usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
        libaio.so.1 => /usr/lib64/libaio.so.1 (0x0000003ca9800000)

/usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_getevent
                 w io_getevents@@LIBAIO_0.4

当然,Linux也必须已经安装了AIO相关的package

rpm -qa | grep aio
libaio-0.3.105-2
libaio-devel-0.3.105-2

可以通过查看slabinfo统计信息查看操作系统中AIO是否运行,slab是Linux的内存分配器,AIO相关的内存结构已经分配的话(第二列和第三列非0)说明AIO已经启用

cat /proc/slabinfo | grep kio
kioctx 102 170 384 10 1 :tunables 54   27 8 : slabdata 17 17 0
kiocb 488 495 256 15 1 :tunables 120 60 8 : slabdata 33 33 120

最后,还需要在Oracle中设置相关的初始化参数来使用AIO

disk_asynch_io = true
filesystemio_options = asynch #文件系统才需要
Categories: aio, oracle Tags:

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin