Why ASMLIB and why not?

ASMLIB是一种基于Linux module,专门为Oracle Automatic Storage Management特性设计的内核支持库(kernel support library)。

长久以来我们对ASMLIB的认识并不全面,这里我们来具体了解一下使用ASMLIB的优缺点。

理论上我们可以从ASMLIB API中得到的以下益处:

  1. 总是使用direct,async IO
  2. 解决了永久性设备名的问题,即便在重启后设备名已经改变的情况下
  3. 解决了文件权限、拥有者的问题
  4. 减少了I/O期间从用户模式到内核模式的上下文切换,从而可能降低cpu使用率
  5. 减少了文件句柄的使用量
  6. ASMLIB API提供了传递如I/O优先级等元信息到存储设备的可能

虽然从理论上我们可以从ASMLIB中得到性能收益,但实践过程中这种优势是几乎可以忽略的,没有任何性能报告显示ASMLIB对比Linux上原生态的udev设备管理服务有任何性能上的优势。在Oracle官方论坛上有一篇<ASMLib and Linux block devices>讨论ASMLIB性能收益的帖子,你可以从中看到”asmlib wouldn’t necessarily give you much of an io performance benefit, it’s mainly for ease of management as it will find/discover the right devices for you, the io effect of asmlib is large the same as doing async io to raw devices.”的评论,实际上使用ASMLIB和直接使用裸设备(raw device)在性能上没有什么差别。

ASMLIB可能带来的缺点:

  1. 对于多路径设备(multipathing)需要在/etc/sysconfig/oracleasm-_dev_oracleasm配置文件中设置ORACLEASM_SCANORDER及ORACLEASM_SCANEXCLUDE,以便ASMLIB能找到正确的设备文件,具体可以参考Metalink Note<How To Setup ASM & ASMLIB On Native Linux Multipath Mapper disks? [ID 602952.1]>
  2. 因为ASM INSTANCE使用ASMLIB提供的asm disk,所以增加了额外的层面
  3. 每次Linux Kernel更新,都需要替换新的ASMLIB包
  4. 增加了因人为错误造成宕机downtime的可能
  5. 使用ASMLIB意味着要花费更多时间去创建和维护
  6. 因为ASMLIB的存在,可能引入更多的bug,这是我们最不想看到的
  7. 使用ASMLIB创建的disk,其disk header并不会和普通的asm disk header有什么不同,仅仅是在头部多出了ASMLIB的属性空间。

结论:
我个人的观点是尽可能不要使用ASMLIB,当然这不是DBA个人所能决定的事情。另一方面这取决于个人习惯,在rhel 4的早期发行版本中没有提供udev这样的设备管理服务,这导致在rhel 4中大量的ASM+RAC组合的系统使用ASMLIB , 经网友指出udev 作为kernel 2.6的新特性被引入,在rhel4的初始版本中就已经加入了udev绑定服务,但是在rhel4时代实际udev的使用并不广泛(In Linux 2.6, a new feature was introduced to simplify device management and hot plug capabilities. This feature is called udev and is a standard package in RHEL4 or Oracle
Enterprise Linux 4 (OEL4) as well as Novell’s SLES9 and SLES10.)。如果是在RHEL/OEL 5中那么你已经有充分的理由利用udev而放弃ASMLIB。

Reference:
ASMLIB Performance vs Udev
RAC+ASM 3 years in production Stories to share
How To Setup ASM & ASMLIB On Native Linux Multipath Mapper disks? [ID 602952.1]
ASMLib and Linux block devices

关注dbDao.com的新浪微博

扫码关注dbDao.com 微信公众号:

Comments

  1. blue_prince says:

    在多节点的RAC环境下用ASMLIB还是有点好处的,因为同一块磁盘在不同节点上映射名不一样,用ASMLIB会方便很多,否则一个个裸设备去绑定,很麻烦的。单机我都用裸设备。

  2. admin says:

    Hello prince,
    在rhel/oel 5中你可以利用udev达到与ASMLIB同样的目的,不需要一个个去绑定。

    • zck521 says:

      怎么可能用udev达到目的跟ASMLib一样?ASMLib是对块设备的支持,让ASMLib设备提供与裸设备相近的性能,而udev提供的只是固定块设备名,给块设备做了个别名,做了udev后还是需要通过ASMLib来提升性能,如果单单用udev生成的设备作为ASM disk,那跟直接使用/dev/sdb1等块设备作为ASM disk有什么区别?最多是增加了固定设备名的好处,性能上肯定是一样的!!
      换句话说用udev设备(实际上还是块设备,块设备的别名而已)的性能与直接用/dev/sdb1等块设备性能相等,但它们的性能都远远低于ASMLib和裸设备!!

      • 同学你有poc测试过吗? 哪一个测试报告结果说明asmlib和裸设备的性能远高于block device?
        asmlib api除了提供了传递如I/O优先级等元信息外还有性能提升的作用?

        块设备的性能远低于裸设备,这是如何得出的结论 ,是否有测试佐证?

      • Linux上raw device 和 block device关系的介绍:http://en.wikipedia.org/wiki/Raw_device
        “Raw devices simply open block devices as if the O_DIRECT flag would have been specified.”

        On Linux raw devices were deprecated and scheduled for removal at one point, because the O_DIRECT flag can be used instead.[1] However, later the decision was made to keep raw devices support since some software cannot use the O_DIRECT flag.[2] Raw devices simply open block devices as if the O_DIRECT flag would have been specified. Raw devices are character devices (major number 162). The first minor number (i.e. 0) is reserved as a control interface and is usually found at /dev/rawctl. A utility called raw[3] can be used to bind a raw device to an existing block device. These “existing block devices” may be disks or CD-ROMs/DVDs whose underlying interface can be anything supported by Linux (e.g. IDE/ATA or SCSI).[citation needed]

  3. Create a UDEV rules file for the Oracle ASM devices, setting permissions to read/write for the group and owner (0660) for the installation owner and the group whose members are to be administrators of the grid infrastructure software.

    For example, using the installation owner grid and using a role-based group configuration, with the OSASM group asmadmin:

    # /bin/cat /etc/udev/rules.d/99-oracle-asmdevices.rules
    KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”350002ac000010b52″, NAME=”vote1″, ACTION==”add|change”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
    KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”350002ac000020b52″, NAME=”vote2″, ACTION==”add|change”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
    KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”350002ac000030b52″, NAME=”vote3″, ACTION==”add|change”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″

    Copy this rules.d/ file to all other nodes on the cluster. For example:

    # /usr/bin/scp 99-oracle-asmdevices.rules root@node2:/etc/udev/rules.d/99-oracle-asmdevices.rules

    2. Restart The UDEV Service
    Restart the UDEV service as follows. Then verify the devices now reflect their intended ownership and permissions:

    On SLES10:
    # /etc/init.d/boot.udev stop
    # /etc/init.d/boot.udev start

    On RHEL5/OEL5/OL5:
    # /sbin/udevcontrol reload_rules
    # /sbin/start_udev

  4. blue_prince says:

    以前是RHEL4的环境,多谢!

  5. Steven Lee says:

    In Linux 2.6, a new feature was introduced to simplify device management and hot plug
    capabilities. This feature is called udev and is a standard package in RHEL4 or Oracle
    Enterprise Linux 4 (OEL4) as well as Novell’s SLES9 and SLES10.

    From http://www.oracle.com/technetwork/database/device-mapper-udev-crs-asm.pdf

  6. 328274961 says:

    asmlib、 udev、 raw 区别?

  7. 请教:我怎么读写asmlib 管理的设备?有对应API吗?

  8. 关于这个介绍,有没有官方的原文介绍,能否给个链接?谢谢!

  9. testzx says:

    Linux中增加一个盘就要再写一条rule,确实麻烦

Trackbacks

  1. […] 6上使用UDEV解决RAC ASM存储设备名问题 利用UDEV服务解决RAC ASM存储设备名 Why ASMLIB and why not? […]

Speak Your Mind

TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569