|
楼主 |
发表于 2017-2-6 09:32:09
|
显示全部楼层
唐老师,这个问题是不是跟硬件也有关系,因为我这些环境都在虚拟平台上
另外我看到这样一篇文章,不知道出处是不是官方?
大意是不是说,ASM在内核2.6版本以上,使用asmlib的,异步IO只取决于参数:disk_asynch_io
我们正常的库默认disk_asynch_io=true,那么正常就会有AIO,但是没有。
而唐老师的库却是dio,那么唐老师的库上disk_asynch_io参数是false的吗?我尝试过修改位false,结果dio也为0
我现在如果不纠结这个问题,那么有一点还是要搞清楚。
对ASM来说,究竟是DIO合适?还是AIO合适?
Goal
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.
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
The 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
If Async I/O is 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
and if Async I/O is 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
In the SLAB allocator there are three different caches involved. The kioctx and kiocb are Async I/O data structures that are defined in aio.h header file. 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-<version>/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}}) = 1gettimeofday({1176916625, 58882}, NULL) = 0io_getevents(-1223102464, 1, 1024, {{0xb7302e34, 0xb7302e34, 8192, 0}}, {600, 0}) = 1...Example strace of dbw0 process with AIO disabled (filesystemio_options = none):
...pwrite64(21, "\6\242\0\0004\21\300\0\220B\243\0\0\0\1\6\207\357\0\0\1"..., 8192, 36077568) = 8192times(NULL) = 1775653082times(NULL) = 1775653082pwrite64(21, "\6\242\0\0<\21\300\0\220B\243\0\0\0\1\6\254\0\0\0\2\0*"..., 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 setting 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, "MSA\0\2\0\10\0P\0\0\0\222\377\377\377@\313\373\5\0\0\0"..., 80) = 80...The first 3 characters, byte-swapped, are ASM, indicating an ASMLib I/O command structure.
另外,有一篇MOS文档,提到的也是类似的问题
Things To Consider For Setting filesystemio_options And disk_asynch_io (文档 ID 1987437.1)
在该文章中的“File System–specific Notes”部分,有如下论述:
File System–specific Notes
File System
Notes
Raw device
Raw device access to disks does not involve a file system. The filesystemio_options parameters is always ignored and direct I/O is always used. Under Linux, block devices are also treated this way.
Direct use of raw or block devices is not supported as of 12c.
ACFS
ACFS is not supported for database files that can be stored directly in ASM, including data files, redo files, and control files, but there is an exception for Linux Exadata. SeeDocument 1929629.1 and Document 1369107.1.
ASM
Oracle bypasses the file system layer for ASM. Thefilesystemio_options parameters is always ignored and direct I/O is always used. SeeDocument 751463.1 for more
FUSE (Linux)
Direct I/O cannot be enabled on FUSE-based file systems.
JFS (IBM)
Not to be confused with JFS or OnlineJFS on HP-UX, which is VxFS as supplied with HP-UX.
JFS comes in two versions. Version 1 of JFS (JFS1) is available on AIX only. Version 2 of JFS (JFS2) is available on several OSes, and is usually called "JFS" on operating systems other than AIX.
JFS1 does not support concurrent I/O, but JFS2 does.
NFS
Using direct I/O is recommended to avoid potential data corruption. See Document 437005.1 for more.
Whether concurrent I/O is used is controlled by the NFS server.
Direct NFS (dNFS) Oracle bypasses the file system layer when using Direct NFS. The filesystemio_options parameters is always ignored and direct I/O is always used.
VxFS/JFS/OnlineJFS (Veritas)
VxFS as supplied with HP-UX is known as JFS or OnlineJFS; not to be confused with IBM JFS.
Direct I/O cannot be set using filesystemio_options on platforms other than HP-UX. Instead, use the convosync=direct and mincache=direct mount options to force direct I/O or the cio option to force concurrent I/O.
Concurrent I/O is an extra option on VxFS (called "Concurrent I/O"). It is also available through the Quick IO option or ODM. Otherwise concurrency will be limited. NB: ODM is the preferred method of accessing Oracle files on VxFS.
VxFS ODM Oracle bypasses the file system layer when using ODM on VxFS. The filesystemio_options parameters is always ignored and direct I/O is always used. Asynchronous I/O is supported natively by the ODM interface.
ZFS
ZFS does not support direct I/O and consequently cannot be used with RAC.
With ZFS you can limit how much RAM the ARC consumes in certain Solaris releases. SeeDocument 1663862.1.
|
|