HP OpenVMS Systems

Buffered vs Direct I/O?

Without global buffers, how does VMS decide how much buffered and direct io its
going to perform on a file that is accessed sequentially? Does fragmentation,
extent sizes, directory sizes influence this decision? Is the decision made
once only when the fi
le is opened? What would make VMS decide to do no buffered io?

The Answer is :

Buffered I/O operations (BUFIO, in the context on RMS indexed file
access) typically indicate file-level operations, notably EXTENTs.
Excessive numbers imply an inadequately-tuned file.
Global buffers do not particularly effect this, as I/O operations
involving an RMS global buffer are direct I/O operations -- directly
analogous to the I/Os used for local buffer operations.
RMS global buffers are very efficient for both read- and write-accessed
files, whether clustered or not. Enabling and using global buffers
tends to be helpful in most cases, and are often of significant benefit
on files that are heavily accessed.
Please recognize that in order to $PUT a record to a file, RMS has to
READ through several layers of index structure and had to read the
target bucket. All of this could be found in a gloabl buffer, when
the file is correctly configured. (Hint: Global buffers are often
specifically sized to hold the entire index structures of a file.)
If a buffer to be written is found in the global buffer, it is simply
used there and written out from there. If the buffer was not available,
only then might RMS choose to read it into a local buffer, but that is
exactly what would have happened had there not been global buffers. No
particular loss, only a potential performance gain.
Only deferred write will muddle the picture some, as this will force
RMS to use a local buffer. If the target is found in the global buffer,
it will do a memory copy to local and will discard the global buffer
original, again no loss.
The only real price for global buffers tends to be the global buffer
lock, which can increase the lock enqueue and dequeue activity -- with
recent versions of OpenVMS and RMS, the aggregate performance of this
serialization logical has been vastly improved.