VERITAS Quick I/O supports direct I/O and allows databases to access regular files on a VxFS file system as raw character devices. The benefits for Oracle databases are improved perofmrance (closer to raw devices) with the ability to manage Quick I/O files as regular files.
Quick I/O’s ability to access regular files as raw devices improves database performance by supporting direct I/O, avoiding kernel write locks on database files and avoiding double buffering.
How Quick I/O Works
Operating systems such as HP-UX provide kernel support for asynchronous I/O on raw devices, but not on regular files. As a result, even if the database server is capable of using asynchronous I/O, it cannot issue asynchronous I/O requests when the database runs on file systems. Lack of asynchronous I/O significantly degrades performance. Quick I/O lets the database server take advantage of kernel-supported asynchronous I/O on file system files accessed using the Quick I/O interface.
I/O on files using read() and write() system calls typically results in data being copied twice: once between user and kernel space, and later between kernel space and disk. In contrast, I/O on raw devices is direct. That is, data is copied directly between user space and disk, saving one level of copying. As with I/O on raw devices, Quick I/O avoids extra copying.
When database I/O is performed using the write() system call, each system call acquires and releases a write lock inside the kernel. This lock prevents multiple simultaneous write operations on the same file. Because database systems usually implement their own locking to manage concurrent access to files, per file writer locks unnecessarily serialize I/O operations. Quick I/O bypasses file system per file locking and lets the database server control data access.
Most database servers maintain their own buffer cache and do not need the file system buffer cache. Database data cached in the file system buffer is therefore redundant and results in wasted memory and extra system CPU utilization to manage the buffer. By supporting direct I/O, Quick I/O eliminates double buffering. Data is copied directly between the relational database management system (RDBMS) cache and disk, which lowers CPU utilization and frees up memory that can then be used by the database server buffer cache to further improve transaction processing throughput.
Configuring the system to use Quick I/O
Quick I/O is part of the VxFS binaries shipped with VERITAS Storage Foundation for Oracle. By default, Quick I/O is enabled when you mount a VxFS file system.
If Quick I/O is not available in the kernel, or the VERITAS Storage Foundation for Oracle license is not installed, a file system mounts by default without Quick I/O, the Quick I/O file name is treated as a regular file, and no error message is displayed. If, however, you specify the -o qio option, the mount command prints the following error message and terminates without mounting the file system.
VxFDD: You don't have a license to run this program vxfs mount: Quick I/O not available
Depending on whether you are creating a new database or are converting an existing database to use Quick I/O, you have the following options:
Creating Quick I/O Files
To use Quick I/O, you must preallocate files on a VxFS file system and use a special file naming convention to access those files. This is done using the
qiomkfile command which attempts to allocate space for an entire file as a single contiguous extent. When this is not possible due to lack of contiguous space on the file system, the file is created as a series of direct extents.
You must preallocate Quick I/O files because they cannot be extended through writes using their Quick I/O interfaces. They are initially limited to the maximum size you specify at the time of creation, but can be extended manually using the
-e options of
The syntax of the qiomkfile command is as follows:
qiomkfile -h <header_size> -s <file_size> <file_name>
Where <header_size> is the size of the header section of the Oracle datafile (typically 64k) and <file_size> is the size that you want to have available within the datafile added to the tablespace (both of these sizes can be specified using k|m|g suffixes). The size of the file on disk that is preallocated is the total size of the file (including the header) rounded to the nearest multiple of the file system block size.
qiomkfile command will actually create two files. a dot (hidden) file and a symbolic link that points to this file and which can be used when adding the datafile to the Oracle database. The hidden file uses a special suffix of
::cdev:vxfs: to ensure the Operating System can recognize and access Quick I/O files as raw character devices (cdev is an acroynm for Character Device).
An example to create a 8GB datafile and add it to the oracle tablespace USER_DATA:
qiomkfile -h 64k -s 8g /oracle02/oradata/DBNAME/user_data.dbf002 sqlplus alter tablespace USER_DATA add datafile '/oracle02/oradata/DBNAME/user_data.dbf002' size 8g; exit
Which will create the following files:
ls -al /oracle02/oradata/DBNAME -rw-rw-r-- 1 oracle dba 8590000128 Aug 26 09:00 .user_data.dbf002 lrwxrwxr-x 1 oracle dba 26 Aug 26 09:00 user_data.dbf002 -> .user_data.dbf002::cdev:vxfs:
When possible, use relative path names instead of absolute path names. Using relative path names prevents copies of the symbolic link from referring to the original file when the directory is copied. This is important if you are backing up or moving database files with a command that preserves the symbolic link.
Converting regular files to Quick I/O files on a VxFS file system
Because Quick I/O files are identified using the special suffix ::cdev:vxfs: it is possible to convert a regular file to a Quick I/O file simply by renaming the file with the suffix and then creating a symbolic link to access it, as shown in below:
mv filename .filename ln -s .filename::cdev:vxfs: filename
Note that converting existing database files to be Quick I/O files may not be the best choice if the files are fragmented. In this is the case, then create new files with the qiomkfile command (which creates a contiguous file) and then move data from the old files to the new files using the dd command or a database import facility, and then define the new files to the database.
Extending / Resizing Quick I/O Files
Although Quick I/O files must be preallocated, they are not limited to the preallocated sizes. You can grow or “extend” a Quick I/O file by a specific amount or to a specific size, using options to the qiomkfile command. Extending Quick I/O files is a fast, online operation and offers a significant advantage over using raw devices.
To extend a Quick I/O file, use the -e option of the qiomkfile command to specify the amount by which to extend the file. For example, to extend the user_data.dbf001 Quick I/O file by 20MB:
qiomkfile -e 20M user_data.dbf001
To resize a Quick I/O file, use the -e option of the qiomkfile command to specify the new size of the file. For example, to resize the user_data.dbf001 Quick I/O file to 300MB:
qiomkfile -r 300M user_data.dbf001