SOLARIS: Asynchronous I/O (AIO) on Solaris (SPARC) servers_48769.1
SOLARIS: Asynchronous I/O (AIO) on Solaris (SPARC) servers (Doc ID 48769.1)
Asynchronous I/O (AIO) on Solaris (SPARC) servers
=================================================
Note that this article discusses normal asynchronous I/O (AIO) which is
not the same as kernel asynchronous I/O (KAIO).
It is documented in (at least) "Oracle for Sun Performance Tuning Tips,
A25584-1" that asynchronous I/O (AIO) is enabled by default on Solaris, and is
supported for database files created on BOTH raw devices and filesystem files.
This is TRUE, however it's not clear how this actually works (especially as
some other UNIX ports cannot support AIO on filesystem files). Also, output
from "truss" can be misleading, and suggest that AIO is not working on
filesystem files. See bug:532270 for an example of just such confusion.
This document attempts to explain the operation of AIO on Solaris version 2.4
and above.
1. Enabling AIO within Oracle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oracle 7 can use asynchronous writes for parallel database writes by DBWR.
This feature is turned ON by default (i.e. the init.ora parameter async_write =
TRUE).
Oracle 7 can use asynchronous reads (specifically for database recovery). This
feature is also turned ON by default (i.e. the init.ora parameter asuync_read =
TRUE).
2. AIO functions used by Oracle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assuming AIO is enabled within Oracle (see above), at relevent points, it will
use the libaio functions aioread() and aiowrite() (as opposed to the normal,
synchronous I/O routines read(), pread(), write(), pwrite() etc.).
This is irrespective of whether the file is a raw device, or a filesystem file
(the Solaris kernel manages the differences).
3. How the Solaris kernel reacts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The use of the aioread() and aiowrite() functions result in calls to the kaio()
system call, with arguments of AIOREAD and AIOWRITE etc.
When the file being operated on is a raw device, these calls succeed and invoke
the kernalised AIO driver.
When the file being operated on is a filesystem file, the first call to
kaio() (with an argument of AIOREAD, or AIOWRITE etc.) will fail with error #48
(Operation not supported). As a result, the normal synchronous IO system calls
pread() and write() are called instead.
This behaviour can cleary be seen in a truss, and is the cause of most
confusion as it suggests AIO is NOT being used on the filesystem file.
4. Truss extract from asynchronously reading a raw device
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28476/1: open("/dev/rdsk/c0t3d0s1", O_RDONLY) = 3
28476/1: kaio(5, 0xFFFFFFE8, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x000000
00, 0xEF7F4298) = 0
28476/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 0, 0xEFFFF9F4) = 0
28476/1: kaio(AIOWAIT, 0x00000000) = -268437004
28476/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 1024, 0xEFFFF9F4) = 0
28476/1: kaio(AIOWAIT, 0x00000000) = -268437004
28476/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 2048, 0xEFFFF9F4) = 0
28476/1: kaio(AIOWAIT, 0x00000000) = -268437004
5. Truss extract from asynchronously reading a filesystem file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28463/1: open("/etc/passwd", O_RDONLY) = 3
28463/1: kaio(5, 0xFFFFFFE8, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x000000
00, 0xEF7F4298) = 0
28463/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 0, 0xEFFFF9FC) Err#48
28463/1: lwp_create(0xEFFFF628, 0, 0xEF781F44) = 3
28463/3: lwp_create(0x00000000, 0, 0x00000000) = -277341360
28463/3: lwp_self() = 3
28463/1: lwp_create(0xEFFFF628, 0, 0xEF778F44) = 4
28463/4: lwp_create(0x00000000, 0, 0x00000000) = -277378224
28463/4: lwp_self() = 4
28463/1: lwp_create(0xEFFFF628, 0, 0xEF6BAF44) = 5
28463/5: lwp_create(0x00000000, 0, 0x00000000) = -278156464
28463/5: lwp_self() = 5
28463/1: lwp_create(0xEFFFF628, 0, 0xEF6B1F44) = 6
28463/6: lwp_create(0x00000000, 0, 0x00000000) = -278193328
28463/6: lwp_self() = 6
28463/3: pread(3, " r o o t : x : 0 : 1 : 0".., 1024, 0) = 1024
28463/4: pread(3, " r y h a : x : 2 1 6 : 1".., 1024, 1024) = 1024
28463/5: pread(3, " s 1 / j c a h i l l : /".., 1024, 2048) = 1024
28463/6: pread(3, " s h\n s f a x : x : 5 0".., 1024, 3072) = 115
6. So how is AIO being implemented for the filesystem file?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the clever bit. The KAIO kernel driver cannot operate on a filesystem
file, so as a result of the first kaio(AIOREAD) failing, the aioread() function
spawns 4 lightweight processes (threads). Each of these threads is responsible
for reading a different section of the file, but in parallel; thereby SIMULATING
asynchronous I/O.
This can be seen in the second truss extract (the thread number follows the / in
the process number).
7. Implications of this behaviour
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Binding Oracle processes (specifically DBWR or server processes) to a CPU
when AIO is in use on filesystem files will impact performance, since all the
spawned threads will also be bound to this same CPU, and therefore be unable to
run in parallel.
Asynchronous I/O (AIO) on Solaris (SPARC) servers
=================================================
Note that this article discusses normal asynchronous I/O (AIO) which is
not the same as kernel asynchronous I/O (KAIO).
It is documented in (at least) "Oracle for Sun Performance Tuning Tips,
A25584-1" that asynchronous I/O (AIO) is enabled by default on Solaris, and is
supported for database files created on BOTH raw devices and filesystem files.
This is TRUE, however it's not clear how this actually works (especially as
some other UNIX ports cannot support AIO on filesystem files). Also, output
from "truss" can be misleading, and suggest that AIO is not working on
filesystem files. See bug:532270 for an example of just such confusion.
This document attempts to explain the operation of AIO on Solaris version 2.4
and above.
1. Enabling AIO within Oracle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oracle 7 can use asynchronous writes for parallel database writes by DBWR.
This feature is turned ON by default (i.e. the init.ora parameter async_write =
TRUE).
Oracle 7 can use asynchronous reads (specifically for database recovery). This
feature is also turned ON by default (i.e. the init.ora parameter asuync_read =
TRUE).
2. AIO functions used by Oracle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assuming AIO is enabled within Oracle (see above), at relevent points, it will
use the libaio functions aioread() and aiowrite() (as opposed to the normal,
synchronous I/O routines read(), pread(), write(), pwrite() etc.).
This is irrespective of whether the file is a raw device, or a filesystem file
(the Solaris kernel manages the differences).
3. How the Solaris kernel reacts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The use of the aioread() and aiowrite() functions result in calls to the kaio()
system call, with arguments of AIOREAD and AIOWRITE etc.
When the file being operated on is a raw device, these calls succeed and invoke
the kernalised AIO driver.
When the file being operated on is a filesystem file, the first call to
kaio() (with an argument of AIOREAD, or AIOWRITE etc.) will fail with error #48
(Operation not supported). As a result, the normal synchronous IO system calls
pread() and write() are called instead.
This behaviour can cleary be seen in a truss, and is the cause of most
confusion as it suggests AIO is NOT being used on the filesystem file.
4. Truss extract from asynchronously reading a raw device
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28476/1: open("/dev/rdsk/c0t3d0s1", O_RDONLY) = 3
28476/1: kaio(5, 0xFFFFFFE8, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x000000
00, 0xEF7F4298) = 0
28476/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 0, 0xEFFFF9F4) = 0
28476/1: kaio(AIOWAIT, 0x00000000) = -268437004
28476/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 1024, 0xEFFFF9F4) = 0
28476/1: kaio(AIOWAIT, 0x00000000) = -268437004
28476/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 2048, 0xEFFFF9F4) = 0
28476/1: kaio(AIOWAIT, 0x00000000) = -268437004
5. Truss extract from asynchronously reading a filesystem file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28463/1: open("/etc/passwd", O_RDONLY) = 3
28463/1: kaio(5, 0xFFFFFFE8, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x000000
00, 0xEF7F4298) = 0
28463/1: kaio(AIOREAD, 3, 0x00020FF0, 1024, 0, 0xEFFFF9FC) Err#48
28463/1: lwp_create(0xEFFFF628, 0, 0xEF781F44) = 3
28463/3: lwp_create(0x00000000, 0, 0x00000000) = -277341360
28463/3: lwp_self() = 3
28463/1: lwp_create(0xEFFFF628, 0, 0xEF778F44) = 4
28463/4: lwp_create(0x00000000, 0, 0x00000000) = -277378224
28463/4: lwp_self() = 4
28463/1: lwp_create(0xEFFFF628, 0, 0xEF6BAF44) = 5
28463/5: lwp_create(0x00000000, 0, 0x00000000) = -278156464
28463/5: lwp_self() = 5
28463/1: lwp_create(0xEFFFF628, 0, 0xEF6B1F44) = 6
28463/6: lwp_create(0x00000000, 0, 0x00000000) = -278193328
28463/6: lwp_self() = 6
28463/3: pread(3, " r o o t : x : 0 : 1 : 0".., 1024, 0) = 1024
28463/4: pread(3, " r y h a : x : 2 1 6 : 1".., 1024, 1024) = 1024
28463/5: pread(3, " s 1 / j c a h i l l : /".., 1024, 2048) = 1024
28463/6: pread(3, " s h\n s f a x : x : 5 0".., 1024, 3072) = 115
6. So how is AIO being implemented for the filesystem file?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the clever bit. The KAIO kernel driver cannot operate on a filesystem
file, so as a result of the first kaio(AIOREAD) failing, the aioread() function
spawns 4 lightweight processes (threads). Each of these threads is responsible
for reading a different section of the file, but in parallel; thereby SIMULATING
asynchronous I/O.
This can be seen in the second truss extract (the thread number follows the / in
the process number).
7. Implications of this behaviour
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Binding Oracle processes (specifically DBWR or server processes) to a CPU
when AIO is in use on filesystem files will impact performance, since all the
spawned threads will also be bound to this same CPU, and therefore be unable to
run in parallel.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1130424/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- asynchronous i/o (aio) on HP-UXAIUX
- Oracle釋出Solaris 11 for Sparc/x86Oracle
- Sun SPARC Solaris系統平臺上的Oracle 8i最佳化調整(轉)Oracle
- HP-UX: Asynchronous i/o (Doc ID 139272.1)UX
- HOW TO CHECK IF ASYNCHRONOUS I/O IS WORKING ON LINUXLinux
- 利用jumpstart網路安裝solaris 10 sparc u4
- 安裝Oracle11.2 RAC for Solaris10 sparc64(五)Oracle
- 安裝Oracle11.2 RAC for Solaris10 sparc64(四)Oracle
- 安裝Oracle11.2 RAC for Solaris10 sparc64(三)Oracle
- 安裝Oracle11.2 RAC for Solaris10 sparc64(二)Oracle
- 安裝Oracle11.2 RAC for Solaris10 sparc64(一)Oracle
- solaris檢視I/O、記憶體、網路效能優化命令 iostat , vmstat記憶體優化iOS
- Asynchronous I/O Support On Windows (Doc ID 1228845.1)Windows
- Solaris10(SPARC)下掛載NFS空間出錯:nfs mount: Not ownerNFS
- 在sun t2000上安裝solaris sparc 10記實
- solaris檢視I/O、記憶體、網路效能最佳化命令 iostat , vmstat記憶體iOS
- Oracle9i for SUN Solaris install(轉)Oracle
- AIX使用非同步I/O(aio)提高系統效能(轉)AI非同步
- Requirements for Installing Oracle 11gR2 RDBMS on Solaris 10 SPARC [ID 964976.1]UIREMOracle
- solaris 安裝 jdk及oracle 9i使用opatchJDKOracle
- 在 Solaris 11 SPARC 上安裝 Oracle Database 12.1 的要求 (文件 ID 1602904.1)OracleDatabase
- solaris DNS 配置DNS
- solaris學習
- Solaris 命令大全
- Solaris IPMP 配置
- How To Check if Asynchronous I/O is Working On Linux (Doc ID 237299.1)Linux
- 安裝三節點RAC11202 on Solaris10 sparc64(三)
- 安裝三節點RAC11202 on Solaris10 sparc64(二)
- 安裝三節點RAC11202 on Solaris10 sparc64(一)
- 【Solaris】Solaris檔案系統管理6 磁碟配額管理
- 【Solaris】Solaris10作業系統 SMF服務管理作業系統
- ORACLE8I FOR SUN SOLARIS2.7 安裝說明(轉)Oracle
- Solaris 10配置VNCServerVNCServer
- solaris 10 disksuite usageUI
- solaris 9 ftp 慢FTP
- 清除solaris密碼密碼
- openssh for solaris 安裝
- Solaris 程式管理(轉)