Chinaunix首页 | 论坛 | 博客
  • 博客访问: 650671
  • 博文数量: 109
  • 博客积分: 6081
  • 博客等级: 准将
  • 技术积分: 1318
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:28
文章分类
文章存档

2011年(8)

2010年(39)

2009年(62)

分类:

2009-12-19 11:16:53

HP-UX AIO 配置
本文针对 HP-UX  11.31 版本,补丁为 2009Jun1131

1、为什么要采用AIO

在Hp-ux中,当采用同步IO的方式时,这就意味着在下一次写IO进行之前,前一次IO必须返回"成功写完成"的信息,可以看到同步IO方式在IO负荷比较大的系统存在着性能的瓶颈。而采用异步IO方式时,在写请求发出之后操作系统会立即反回给应用一个写成功的信息,余下的事就由操作系统完成了。在 Hp-ux中使用Oracle、Sybase这些数据库时,为减少IO的瓶颈、提高库的性能,建议打开异步IO,Hp在这方面相对Aix来说相对麻烦一些( AIX 6.1 以后 已经采用了动态的 AIO,已经没有AIO设备了)

2、如何创建 AIO

----Hp-ux11.31 使用Aio的补丁为:累积补丁包。
#swlist -l product |grep async
  PHKL_38305            1.0            asyncdsk cumulative patch

----如果没有async 设备,创建aio的字符设备(HP-UX 11.31默认生成该设备 )
#ls  /dev/async*      //查看是否有这两个文件
/dev/async    /dev/asyncdsk

#/sbin/mknod /dev/async c 101 0x0   //建立aio字符设备
#chown oracle:dba /dev/async        //调整设备的属主,这个例中假定用户为oracle,组为dba
#chmod 660 /dev/async             

----内核参数调整
a、把asyncdsk         11.31不需要调整
    sam-> Kernel Configuration -> Drivers->asyncdsk调整为in
    #reboot
b、调整max_async_ports参数
    这个参数限定的是同时使用/dev/async设备的最大进程数,对于Oracle这个参数应大于等于init.ora中的 processes+后台的进程数,对于sybase它所标识的是最大的工作进程数。当max_async_ports的值达到时,其余的进程将采用同步 IO的方式。
c、调整set aio_max_ops参数
    这个参数所限定的是在任意一个时间点排队的Aio操作的最大的数目,一般保持默认值就可以,可以用glance监测一下。
d、调整fs_async参数
   这个参数表明的是对文件系统的写是否采用Aio的方式,设定fs_async=0指定对于文件系统写不用Aio,设定fs_async=1则指定使用aio的方式,Oracle不建议将这个什设置为1

注意:11.31不需要调整以上参数,都是动态的。
aio_iosize_max               Dynamic     0            0           0            -         aio
aio_listio_max               Dynamic     256          256         256          -         aio
aio_max_ops                  Dynamic     2048         2048        2048         -         aio
aio_monitor_run_sec          Dynamic     30           30          30           -         aio
aio_physmem_pct              Dynamic     10           10          10           -         aio
aio_prio_delta_max           Dynamic     20           20          20           -         aio
aio_proc_max                 Dynamic     0            0           0            -         aio
aio_proc_thread_pct          Dynamic     70           70          70           -         aio
aio_proc_threads             Dynamic     1024         1024        1024         -         aio
aio_req_per_thread           Dynamic     1            1           1            -         aio
fs_async                     Static      0            0           0            -         fs 
max_async_ports              Dynamic     4096         4096        4096         -         asyncdsk


-----oracle用户的组
(一般为dba)设定MLOCK的权限,否则在数据库启动会报错或在库运行时会出现莫名其妙的数据库hang的现象。
两种方式设置:
a、涉及到两个命令getprivgrp用于检查组有什么权限,setprivgrp用于设定组的权限,举个例子大家就明白了
   eg1:检查dba组是否有MLOCK的权限
     root#getprivgrp dba
   eg2:设定dba组的MLOCK的权限
     roolt#setprivgrp dba MLOCK

b、也可以把设定加入配置文件中,这样在下次启动时就自动生效了。
   在/etc/privgroup中加入如下的一行:
    dba MLOCK  
   如果privgroup不存在,可以编辑一个。
   #setprivgrp -f /etc/privgroup

3、检查一下aio是否生效了
  #fuser /dev/async
/dev/async:     9064o   27599o    8898o   27601o   19524o   16677o   27605o
  有进程列出来说明aio已经生效了。

查看oracle $ORACLE_BASE/admin/$ORACLE_SID/udump 是否生成 .trc 文件产生 AIO 相关的错误报告
查看oracle $ORACLE_BASE/admin/$ORACLE_SID/bdump 是否生成 .trc 文件产生 AIO 相关的错误报告
#su  - oracle
#cd $ORACLE_BASE/admin/$ORACLE_SID/
#ls
adump  bdump  cdump  dpdump  pfile udump
#cd udump
#rm -f * 
#ls -l     //确认是否生成.trc文件
#cd ../bdump
#rm -f *   
#ls -l     //确认是否还生成.trc文件

4、oracle数据库相关参数配置

SQL> show parameter disk_asyn
SQL> show parameter filesystemio_option
a、当oracle数据库存储方式采用 裸设备时。采用以下参数设计:
    SQL> alter system set disk_asynch_io=TRUE scope=spfile   //该参数不是动态的
    SQL> alter system set filesystemio_options=async scope=spfile   //该参数不是动态的

b、当oracle10.2版本的数据库存储方式为 文件系统时,采用以下参数设计:
    SQL> alter system set disk_asynch_io=false scope=spfile   //该参数不是动态的
    SQL> alter system set filesystemio_options=none scope=spfile   //该参数不是动态的

以上参数的改变都要重启数据库。
-----------------------------------------------------------------------------------------------------------
说明:
On HP-UX, when the Oracle datafiles reside on a filesystem, then the DBWR
process(es) make synchronous writes to these datafiles. This means that each
write must return with a 'succesful completion' before the next write is
issued. This serial operation can lead to a i/o bottleneck. There are two ways
to counteract this:
a. configure multiple DBWR processes
b. use asynchronous i/o

Before deciding on one of these two options, it should be noted that on HP-UX,
aio is *only* possible on a raw device. Put in another way, aio *cannot* be used
on a filesystem.
Multiple DBWRs can be used on a filesystem.
It is not recommended to use both multiple DBWRs and aio.

oracle数据库参数 FILESYSTEMIO_OPTIONS 说明:
You can use the FILESYSTEMIO_OPTIONS initialization parameter to enable or
disable asynchronous I/O or direct I/O on file system files. This parameter is
platform-specific and has a default value that is best for a particular platform. It can be dynamically changed to update the default setting.

FILESYTEMIO_OPTIONS can be set to one of the following values:

■ ASYNCH: enable asynchronous I/O on file system files, which has no timing
requirement for transmission.

■ DIRECTIO: enable direct I/O on file system files, which bypasses the buffer
cache.

■ SETALL: enable both asynchronous and direct I/O on file system files.

■ NONE: disable both asynchronous and direct I/O on file system files.

阅读(13205) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~