Increasing performance of index file I-O using sharing modes

0 Likes
over 8 years ago

Problem

Customer is running a large batch process that performs a lot of file I-O on indexed files and they would like to know if there is an option available that would help to speed up the performance when reading these files.

Resolution:

They might want to look at using sharing modes for their file processing.
Sharing modes inform the file handler how others will be accessing the files while the current process is accessing the files.

The default is that the file handler assumes that files open for input or i-o will be sharable by all other processes. This means that the file handler has to be constanly checking to ensure that the file has not been updated by someone else since the last time it was read and this can be time consuming.This is true even on a standalone single-user system where the file is not being shared.

By setting a sharing mode to allow no other then this will give you exclusive access to the file and the file handler will know that the file will not be changed by another process so it can speed processing time quite a bit. Likewise if you set the sharing mode to allow read only, then the file can be shared by others but cannot be updated.

These sharing modes can be set either in the select statement:

    select test-file assign to...
                           sharing with all other/no other

or on the open statement:

    open input sharing with all other/no other/read only test-file

In a recent test the following timings were returned while reading 8 million records sequentially from an indexed file.

sharing with all other   = 8 mins 40 secs
sharing with read only = 4 mins 23 secs
sharing with no other   = 2 mins 02 secs

 

Comment List
Anonymous
Related Discussions
Recommended