I - O Behavior On Oracle Database in ASM
I - O Behavior On Oracle Database in ASM
of lesystemio_options Parameter
A complete review of I/O behavior in Oracle database in ASM
and OS con guration
plus recommendations
The purpose of this document is to explain the behaviour of I/O calls depending database
parameters FILESYSTEMIO_OPTIONS and DISK_ASYNCH_IO when the Oracle RDBMS is
located on ASM diskgroups.
FILESYSTEMIO_OPTIONS controls the behaviour of I/O options given by operating system but it
has no a ect when ASM is used.
FILESYSTEMIO_OPTIONS enables asynchronous I/O (AIO) when the value is set to SETALL/
ASYNC.
📍 However, ASM bypasses the lesystem layer in this case because ASM I/O is entirely
controlled by DISK_ASYNCH_IO parameter.
In order to test this behaviour database writer process (DBW0) is traced with strace during a
tablespace creation.
An example strace of dbw0 process when AIO is used shows io_submit/io_getevents calls.
and the strace of dbw0 process with AIO disabled shows pwrite64:
100M tablespace is created and oracle dbw0 process of database instance is traced with strace
tool.
...
sqlplus / as sysdba
Same test is repeated for each possible value to enable and disable asynchronous I/O with the
parameters and the following results are found:
Con g 1:
FILESYSTEMIO_OPTIONS=SETALL
DISK_ASYNCH_IO=TRUE
times(NULL) = 532400079
times(NULL) = 532400079
io_submit(5623808, 2, {...}) = 2
gettimeofday({1227275694, 483102}, NULL) = 0
io_getevents(5623808, 1, 1024, {...}{600, 0}) = 1
times(NULL) = 532400079
io_getevents(5623808, 1, 1024, {...}{600, 0}) = 1
times(NULL) = 532400079
When both parameters are activated to use asynchronous I/O, dbw0 process performs the
I/O asynchronously. The result is expected.
Con g 2:
FILESYSTEMIO_OPTIONS=NONE
DISK_ASYNCH_IO=TRUE
gettimeofday({1227275539, 15789}, NULL) = 0
times(NULL) = 532384532
io_submit(13086720, 2, {...}) = 2
gettimeofday({1227275539, 16181}, NULL) = 0
io_getevents(13086720, 1, 1024, {...}{600, 0}) = 1
times(NULL) = 532384532
io_getevents(13086720, 1, 1024, {...}{600, 0}) = 1
Con g 3:
FILESYSTEMIO_OPTIONS=NONE
DISK_ASYNCH_IO=FALSE
Con g 4:
FILESYSTEMIO_OPTIONS=SETALL
DISK_ASYNCH_IO=FALSE
gettimeofday({1227275223, 67935}, NULL) = 0
times(NULL) = 532352937
pwrite64(21, "\36\242\0\0\3\0@\1\25k\v\0\0\0\2\4ZA\0\0\5\0\0\0\t\0\0\0\0\0\0\0"..., 8192,
5628780544) = 8192
times(NULL) = 532352937
times(NULL) = 532352937
pwrite64(22, "\36\242\0\0\3\0@\1\25k\v\0\0\0\2\4ZA\0\0\5\0\0\0\t\0\0\0\0\0\0\0"..., 8192,
5565865984) = 8192
times(NULL) = 532352937
In the last two cases, whatever the lesystemio_options is set, if DISK_ASYNCH_IO is false, IO is
done synchronously.
⛳ So, you can also control the ASMLIB by changing the value for disk_asynch_io parameter.
When using ASMlib, the result show read calls that look like this in the strace output:
DISK_ASYNCH_IO In 23c
DISK_ASYNCH_IO controls whether I/O to data les, control les, and log les is asynchronous
(that is, whether parallel server processes can overlap I/O requests with CPU processing during
table scans).
Property Description
Parameter type Boolean
Default value true
Modi able No
Modi able in a PDB No
Range of values true | false
Basic No
If your platform supports asynchronous I/O to disk, Oracle recommends that you leave this
parameter set to its default value.
However, if the asynchronous I/O implementation is not stable, you can set this parameter to false
to disable asynchronous I/O. If your platform does not support asynchronous I/O to disk, this
parameter has no e ect.
If you set DISK_ASYNCH_IO to false, then you can increase DB_WRITER_PROCESSES or use
DBWR_IO_SLAVES to simulate asynchronous I/O
Note:If the le system les are managed through ODM library interface or Direct NFS Client,
asynchronous Input-Output is enabled by default.
There is no need to set FILESYSTEMIO_OPTIONS to enable asynchronous Input-Output in these
environments.
SOLUTION
The slabinfo maintains statistics about objects in memory. Some of the structs used by
Asynchronous I/O are treated as objects in the virtual memory, so we can look for those structs on
slabinfo.
The ones related to AIO are named kio*.
or
kioctx 518 670 384 10 1 : tunables 54 27 8 : slabdata 67 67 0
kiocb 595 720 256 15 1 : tunables 120 60 8 : slabdata 48 48 60
or
kioctx 0 0 384 10 1 : tunables 54 27 8 :
slabdata 0 0 0
kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0
In UEK4 the slabinfo entries for aio are no longer available. The caches used by the aio code are
merged with other caches:
If you have the source code loaded, you can review it at le aio.h.
This le 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 lesystemio_options =
asynch) shows:
...
io_submit(3071864832, 1, {{0xb7302e34, 0, 1, 0, 21}}) = 1
gettimeofday({1176916625, 58882}, NULL) = 0
io_getevents(-1223102464, 1, 1024, {{0xb7302e34, 0xb7302e34, 8192, 0}}, {600, 0}) = 1
...
Also you can use OSWatcher tools to achieve more details and information.
You will never see any kioctx or kiocb structures from ASMLib.
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.
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 con gured 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 rst 3 characters, byte-swapped, are ASM, indicating an ASMLib I/O command structure.
Note: Recommend "strace -c" which doesn't cause too much overhead.
I/O operations in UNIX and Linux systems typically go through the le system cache. Although
this doesn't represent a problem in itself, this extra processing does require resources. Bypassing
the le system cache reduces CPU requirements, and frees up the le system cache for other
non-database le operations. Operations against raw devices automatically bypass the le
system cache.
When a synchronous I/O request is submitted to the operating system, the writing process blocks
until the write is complete before continuing processing. With asynchronous I/O, processing
continues while the I/O request is submitted and processed. This allows asynchronous I/O to
bypass some of the performance bottlenecks associated with I/O operations.
Oracle can take advantage of direct I/O and asynchronous I/O on supported platforms using the
FILESYSTEMIO_OPTIONS parameter, whose possible values are listed below.
• ASYNCH - Enabled asynchronous I/O where possible.
• DIRECTIO- Enabled direct I/O where possible.
• SETALL- Enabled both direct I/O and asynchronous I/O where possible.
fi
fi
fi
fi
fi
fi
fi
• NONE - Disabled both direct I/O and asynchronous I/O.
Most of the performance tuning issues can be related to I/O in any database. Oracle provides only
two main parameters to control I/O behaviour these are lesystemio_options and disk_asynch_io
As example if you setting up Oracle database to handle large I/O of new Dataware house project.
And set lesystemio_options to setall.
This maybe speeded up load operations aproximately by 5% whose caching in le system was
not useful as these were insert statements and not repeated.
At the same time increased SGA to quite high to cache I/O as much as possible so that repetitive
select queries can bene t from SGA as in this case when lesystemio_options was set to setall
then le system cache was not available.
You would be keen to disable asynchronous I/O when you see high average_wait on event
db_ le_parallel_wait.
Other reason for turning it o will be synchronous I/O is more reliable.
SQL> select event,average_wait from v$system_event where event like 'db le parallel write';
EVENT AVERAGE_WAIT
----------------- ------------
db le parallel write 28.2 [ centi seconds]
This is not a good ASYNCH I/O. Try Synchronous I/O and check.
Note 1:
Asynchronous I/O operations are more prone to block corruptions than synchronous operations
so many DBAs disable it and follow practice as mentioned in above paragraph.
So if you do not have standby databases and oracle 11g and newer then which autoamatically
recovers corrupted block on primary then you would not want asynchronous I/O.
Note 2: From 11g R2 for tuning purpose, the “db le async I/O submit” should be treated
as “db le parallel write” in previous releases.
fi
fi
fi
fi
fi
fi
ff
ff
fi
ff
fi
fi
fi
ff
fi
fi
fi
fi
fi
db le parallel write
This event occurs in the DBWR. It indicates the time that DBWR spends waiting for I/O
completion.
If asynchronous I/O is available, then the db le asynch I/O submit wait event captures any time
spent in submitting I/Os to the underlying storage.
When asynchronous I/O is not available, db le parallel write captures the time spent during
submit and reap.
Wait Time: While there are outstanding I/Os, DBWR waits for some of the writes to complete.
DBWR does not wait for all of the outstanding I/Os to complete.
Some Oracle shops are plagued with slow I/O intensive databases, and this tip is for anyone
whose STATSPACK top-5 timed events shows disk I/O as a major event.
This tip is important to you if you have reads waits in your top-5 timed events. Remember, if disk
I/O is not your bottleneck then making it faster WILL NOT improve performance.
Also, this is a OS-level solution, and often I/O-bound Oracle databases can be xed by tuning the
SQL to reduce unnecessary large-table full-table scans.
Monitoring le I/O using the stats$ lestatxs view:
For optimal disk performance, Oracle should always use direct I/O to its data les, bypassing any
caching at the OS layer.
The debate:
Oracle supports multiple blocksized tablespaces in a single database including 2k, 4k, 8k, 16k
and 32k blocksizes.
The debate is about the bene t of di erent blocksizes (e.g. 8k, 32k) for reducing Oracle physical
disk I/O and about whether the SA is likely to con gure the Oracle server to use direct I/O for
Oracle.
Some claim that placing large-related things (i.e. indexes) in a large blocksize results in a single
physical fetch (less disk I/O), but others say this is NOT true because the OS blocksize (and the
JFS cache) result in multiple OS I/O.
According to this web page on direct I/O by Steve Adams:
http://www.ixora.com.au/q+a/io.htm
"It also avoids performance problems associated with using database block sizes that do not
match the le system bu er size exactly. (more).
Whether direct I/O is available, and the way in which it can be enabled, are dependent on the
operating system and le system type in use. Direct I/O can sometimes be enabled for an entire
le system, using a le system mount option. Application programs may also be able to request
direct I/O for a particular le by setting a ag when opening the le."
Adams goes on to note that direct I/O can increase the size of the RAM available for the working
set in the Oracle data bu ers:
"By switching to raw or direct I/O and by giving Oracle the memory that would otherwise be used
by the operating system to cache Oracle data, a much larger working set of data can be cached,
and a much higher cache hit rate can be sustained with obvious performance bene ts."
fi
fi
fi
fi
fi
fi
fi
fi
fi
ff
ff
fi
fi
fi
ff
fl
fi
fi
fi
fi
fi
fi
fi
Oracle controls direct I/O with a parameter named lesystemio_options. According to this page by
Steve Adams the lesystemio_options parameter must be set in order for Oracle to read data
blocks directly from disk:
"Databases that use a combination of say raw log les and raw temp les with le system based
data les may wish to use kernelized asynchronous I/O against the raw les, but to avoid ine cient
threaded asynchronous I/O against the data les.
This can be done by allowing disk_asynch_io to default to TRUE, but setting lesystemio_options
to either none or directIO."
• Veritas VxFS - (including HP-UX, Solaris and AIX), look for "convosync=direct". It is also
possible to enable direct I/O on a per- le basis using Veritas QIO; refer to the "qiostat"
command and corresponding man page for hints. For HPUX, see Oracle on HP-UX - Best
Practices.
• Linux - Linux systems support direct I/O on a per- lehandle basis (which is much more exible),
and I believe Oracle enables this feature automatically. Someone should verify at what release
Oracle started to support this feature (it is called O_DIRECT). See Kernel Asynchronous I/O
(AIO) Support for Linux and this great OTN article: Talking Linux: OCFS Update.
I have found that the culprit in a few databases is tables that need purging or better indexing of
columns.
The memory/IO hogs can be seen with the following query. When I create the indexes or purge
rows, I nd my db block hit ratio jumping and the physical reads per hour dropping and the meg
of memory in the following query dropping:
Regards,
Alireza Kamrani.
ff
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fl
ffi