Enabling Asynchronous Writes

By default, the Cache Manager writes all data to the File Server immediately and synchronously when an application program closes a file. That is, the close system call does not return until the Cache Manager has actually written all of the cached data from the file back to the File Server. You can enable the Cache Manager to write files asynchronously by specifying the number of kilobytes of a file that can remain to be written to the File Server when the Cache Manager returns control to the application.

Enabling asynchronous writes can be helpful to users who commonly work with very large files, because it usually means that the application appears to perform faster. However, it introduces some complications. It is best not to enable asynchronous writes unless the machine's users are sophisticated enough to understand the potential problems and how to avoid them. The complications include the following:

When you enable asynchronous writes by issuing the fs storebehind command, you set the number of kilobytes of a file that can still remain to be written to the File Server when the Cache Manager returns control to the application program. You can apply the setting either to all files manipulated by applications running on the machine, or only to certain files:

To set the default store asynchrony

  1. Become the local superuser root on the machine, if you are not already, by issuing the su command.

       % su root
       Password: <root_password>
    
  2. Issue the fs storebehind command with the -allfiles argument.

       # fs storebehind -allfiles  <new default (KB)> [-verbose]
    

    where

    st

    Is the shortest acceptable abbreviation of storebehind.

    -allfiles

    Sets the number of kilobytes of data that can remain to be written to the File Server when the Cache Manager returns control to the application that closed a file.

    -verbose

    Produces a message that confirms the new setting.

To set the store asynchrony for one or more files

  1. Verify that you have the w (write) permission on the access control list (ACL) of each file for which you are setting the store asynchrony, by issuing the fs listacl command, which is described fully in Displaying ACLs.

       % fs listacl dir/file path
    

    Alternatively, become the local superuser root on the client machine, if you are not already, by issuing the su command.

       % su root
       Password: <root_password>
    
  2. Issue the fs storebehind command with the -kbytes and -files arguments.

       # fs storebehind -kbytes <asynchrony for specified names> \
                        -files <specific pathnames>+  \
                        [-verbose]
    

    where

    st

    Is the shortest acceptable abbreviation of storebehind.

    -kbytes

    Sets the number of kilobytes of data that can remain to be written to the File Server when the Cache Manager returns control to the application that closed a file named by the -files argument.

    -files

    Specifies each file for which to set a store asynchrony that overrides the default. Partial pathnames are interpreted relative to the current working directory.

    -verbose

    Produces a message that confirms that new setting.

To display the default store asynchrony

  1. Issue the fs storebehind command with no arguments, or with the -verbose flag only.

       % fs storebehind  [-verbose]
    

    where

    st

    Is the shortest acceptable abbreviation of storebehind.

    -verbose

    Produces output that reports the default store asynchrony.

To display the store asynchrony for one or more files

  1. Issue the fs storebehind command with the -files argument only.

       % fs storebehind -files <specific pathnames>+ 
    

    where

    st

    Is the shortest acceptable abbreviation of storebehind.

    -files

    Specifies each file for which to display the store asynchrony. Partial pathnames are interpreted relative to the current working directory.

The output lists each file separately. If a value has previously been set for the specified files, the output reports the following:

   Will store up to y kbytes of file asynchronously.
   Default store asynchrony is x kbytes.

If the default store asynchrony applies to a file (because you have not set a -kbytes value for it), the output reports the following:

   Will store file according to default.
   Default store asynchrony is x kbytes.