- Cache data in Oracle data buffer cache and again in file system buffer cache is wasting of memory by double caching.
- DBA can manage how the data block to be cached inside Oracle but not for file system cache buffer.
- System buffer cache can mislead the Oracle system statistics for physical IO, since it maybe read from file system cache but as physical read from Oracle point of view.
- It also complicates database tuning because the cost of physical IO is the not same because it may came from file system buffer cache or true disk IO.
- On some operating system, it is possible that system buffer cache keeps expanding until all physical memory is consumed, resulting system crash.
dirctio=yes
SQL> create table gene_drop tablespace mm_data_temp nologging as select * from gene;
Table created.
Elapsed: 00:00:50.46
dirctio=none
SQL> create table gene_drop tablespace mm_data_temp nologging as select * from gene;
Table created.
Elapsed: 00:00:12.40
The table gene is about 500 MB in size and is cached so not physical io is needed to read it. From Linux document, the write actually is on file system buffer cache until it is more than 30 seconds old or more that 10% of the cache. Any way, file system buffer cache can smooth out the disk write load.
Whether Oracle uses direct IO is not only dependent on the filesystemio_options parameter, but the OS, file system type, storage device, mount option, device driver and so on. The following procedure can be used to check if direct IO is used in Linux.
- startup database mount.
- ind the db writer by “select spid, program from v$process where program like '%DBW%';”, write down the spid number.
- do strace of db writer process, such as strace -o /tmp/strace.out -e trace=open -p 2260
- alter database open.
- Open the strace output file and looking for “O_DIRECT”, the sample file is some thing like open("/.../tst01.dbf", O_RDWR|O_SYNC|O_DIRECT) = 22.
In conclusion, to set filesystemio_options to directio or not is dependent on you system, hardware, database, application and load pattern. This is why DBA is paid for and is needed to make such decision.
No comments:
Post a Comment