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:
In most cases, the Cache Manager returns control to applications earlier than it does by default, but it is not guaranteed to do so. Users cannot always expect faster performance.
If an asynchronous write fails, there is no way to notify the application, because the close system call has already returned with a code indicating success.
Asynchronous writing increases the possibility that the user fails to notice when a write operation makes a volume exceed its quota. As always, the portion of the file that exceeds the quota is lost, as indicated by a message like the following:
No space left on device
To avoid losing data because of insufficient quota, before closing a file users must verify that the volume housing the file has enough free space to accommodate it.
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:
The setting that applies to all files is called the default store asynchrony for the machine, and persists until the machine reboots. If, for example, you set the default store asynchrony to 10 KB, it means that when an application closes a file, the Cache Manager can return control to the application as soon as no more than 10 KB of a file that the application has closed remain to be written to the File Server.
The setting for an individual file overrides the default store asynchrony and persists as long as there is an entry for the file in the internal table that the Cache Manager uses to track information about files. In general, such an entry persists at least until an application closes the file or exits completely, but the Cache Manager is free to recycle the entry if the file is inactive and it needs to free up slots in the table. To be sure the entry exists in the table, issue the fs storebehind command shortly before closing the file.
Become the local superuser root on the machine, if you are not already, by issuing the su command.
% su root
Password: <root_password
>
Issue the fs storebehind command with the -allfiles argument.
# fs storebehind -allfiles <new default (KB)
> [-verbose]
where
Is the shortest acceptable abbreviation of storebehind.
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.
Produces a message that confirms the new setting.
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
>
Issue the fs storebehind command with the -kbytes and -files arguments.
# fs storebehind -kbytes <asynchrony for specified names
> \ -files <specific pathnames
>+ \ [-verbose]
where
Is the shortest acceptable abbreviation of storebehind.
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.
Specifies each file for which to set a store asynchrony that overrides the default. Partial pathnames are interpreted relative to the current working directory.
Produces a message that confirms that new setting.
Issue the fs storebehind command with no arguments, or with the -verbose flag only.
% fs storebehind [-verbose]
where
Is the shortest acceptable abbreviation of storebehind.
Produces output that reports the default store asynchrony.
Issue the fs storebehind command with the -files argument only.
% fs storebehind -files <specific pathnames
>+
where
Is the shortest acceptable abbreviation of storebehind.
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.