System Administration Guide, Volume I
  Rechercher uniquement dans ce livre
Télécharger cet ouvrage au format PDF

Setting Up and Viewing CacheFS Statistics

36

This is a list of step-by-step instructions on how to set up and view the CacheFS statistics:
CacheFS Statisticspage 600
Prerequisites for Setting Up and Viewing the CacheFS Statisticspage 601
Setting Up CacheFS Statisticspage 602
Setting Up the Logging Processpage 603
How to Set Up the Logging Processpage 603
Viewing the Cache Sizepage 607
How to View the Working Set (Cache) Sizepage 607
Viewing the Statisticspage 609
How to View Cache Statisticspage 609
The Cache Structure and Behaviorpage 610
Consistency Checking of Cached File Systems With the Back File Systempage 611
Consistency Checking on Demandpage 611

CacheFS Statistics

CacheFS statistics enable you to:
  • Determine an appropriate cache size
  • Observe the performance of the cache
These two pieces of information will help you determine the trade-off between your cache size and the desired performance of the cache.
The CacheFS statistics consist of three commands:
cachefslogSpecifies the location of the log file. This command also displays where the statistics are currently being logged, and enables you to halt logging. See the cachefslog(1M) man page for more information.
cachefswssizeInterprets the log file to give a recommended cache size.
cachefsstatDisplays statistical information about a specific file system or all cached file systems. The information provided in the output of this command is taken directly from the cache. See the cachefsstat(1M) man page for more information.

Note - The CacheFS statistics commands can be issued from any directory. You must be root to issue the cachefswssize(1M) command.

The statistics begin accumulating when you create the log file. When the work session length of time is up, stop the logging by using the cachefslog -h command, as described in "How to Stop the Logging Process" on page 606.

Prerequisites for Setting Up and Viewing the CacheFS Statistics

Before using the CacheFS statistics commands, you must:
  • Set up your cache using the cfsadmin(1M) command.
  • Decide on an appropriate length of time to allow statistical information to collect in the log file you create. The length of time should equal a typical work session; for example, a day, a week, or a month.
  • Select a location or path for the log file. Make sure there is enough space to allow for the growth of the log file. The longer you intend to allow statistical information to collect in the log file, the more space you will need.

Note - The following procedures are presented in a recommended order. The order is not required.

Setting Up CacheFS Statistics

Table 36-1 shows the steps involved to set up CacheFS statistics.
Table 36-1 Setting Up CacheFS Statistics
Activity........Description
For Instructions, Go To
Set Up Logging
Set up logging on a cached file system using the
· How to Set Up the...page 603
cachefslog command.
Logging Process
Locate the Log File
Locte the log file with the cachefslog
· How to Locate the Log File page 605
command.
Stop the
Stop the logging process with the cachefslog
· How to Stop the Logging page 606
Logging Process
command.
Process
View the Cache
View the cache size using the cachefswssize
· How to View the Working page 607
Size
command.
Set (Cache) Size
View the Cache Sta-
View the statistics using the cachefsstat
· How to View Cache...page 606
tistics
command.
Statistics

Setting Up the Logging Process

The first step in the process of determining your ideal cache size is to set up the log file. The statistics are collected in the log file. You can then locate the log file in case you need to verify its location. You stop the logging process on a particular cached file system after you have gathered the necessary information about the cache.

· How to Set Up the Logging Process

Set up the logging process with the cachefslog command.

  $ cachefslog -f     log-file-path mount-point  

In this command,
-f optionSets up the logging process.
log-file-pathRepresents the location of the log file. The log file is a standard file you create with an editor, such as vi.
mount-pointDesignates the mount point (cached file system) for which statistics are being collected.

Example--Setting Up the Logging Process

The following example sets up the log file samlog to collect statistics about /home/sam. The location of samlog is /var/tmp/samlog.

  $ cachefslog -f /var/tmp/samlog /home/sam  
    /var/tmp/samlog: /home/sam  

Verification--Setting Up the Logging Process

  1. To verify that you set up the log file correctly, use the cachefslog command, as follows:


  $ cachefslog mount-point  

For example:

  $ cachefslog /home/sam  
  /var/tmp/samlog: /home/sam  

· How to Locate the Log File

You can also use the cachefslog(1M) command with no options to locate a log file for a particular mount point.

  $ cachefslog mount-point  

In this command,
mount-point.....Is the cached file system for which you want to view the statistics.

Examples--Locating the Log File

The following example shows that no log file has been set up for the specified file system.

  $ cachefslog /home/zap  
       not logged: /home/zap  

· How to Stop the Logging Process

Use the -h option of the cachefslog(1M) command to stop the logging process.

  $ cachefslog -h mount-point  

Example--Stopping the Logging Process

The following example shows what you would see if a log file has been set up. The location of the log file is /var/tmp/stufflog.

  $ cachefslog /home/stuff  
        /var/tmp/stufflog: /home/stuff  

The following example halts logging on /home/stuff.

  $ cachefslog -h /home/stuff  
  not logged: /home/stuff  

Verification--Stopping the Logging Process

If you get a system response other than the one specified in the above example, you did not successfully stop the logging process. Check to see if you are using the correct log file name and mount point.

Viewing the Cache Size

You may want to check if you need to increase the size of the cache or determine what the ideal cache size is based on your activity since you last used the cachefslog(1M) command for a particular mount point.

· How to View the Working Set (Cache) Size

  1. Become root.

  2. View the current and highest logged cache size with the

    cachefswssize(1M)</> command.


  # cachefswssize     log-file-path  

Example--Viewing the Working Set (Cache) Size

In the following example, the end size is the size of the cache at the time you issued the cachefswssize command. The high water size is the largest size of the cache during the time frame in which logging has occurred. The end size is the current size of the cache.

  # cachefswssize /var/tmp/samlog  
  
      /home/sam  
              end size:  10688k  
       high water size:  10704k  
  
      /  
              end size:   1736k  
       high water size:   1736k  
  
      /opt  
              end size:    128k  
       high water size:    128k  
  
      /nfs/saturn.dist  
              end size:   1472k  
       high water size:   1472k  
  
      /usr/openwin  
              end size:   7168k  
       high water size:   7168k  
  
      /nfs/venus.svr4  
              end size:   4688k  
       high water size:   5000k  
  
      /usr  
              end size:   4992k  
       high water size:   4992k  
  
      total for cache  
          initial size: 110960k  
              end size:  30872k  
       high water size:  30872k  

Viewing the Statistics

You may want to view certain information about a specific cached file system. The following table explains the terminology displayed in the statistics output.
Table 36-2
Output TermDescription
hit rateThe rate of cache hits versus cache misses, followed by the actual number of hits and misses. A cache hit occurs when the user wants to perform an operation on a file or files, and the file or files are actually in the cache. A cache miss occurs when the file was not in the cache. The load on the server is the sum of cache misses, consistency checks, and modifications (modifies).
checksThe number of consistency checks performed, followed by the number that passed, and the number that failed.
modifiesThe number of modify operations; for example, writes or
creates.

· How to View Cache Statistics

View the statistics with the cachefsstat(1M) command. You can do this at any time. For example, you do not have to set up logging in order to view the statistics.

  $ cachefsstat mount-point  

In this command,
mount-point......Is the cached file system for which you want to view the statistics.
If you do not specify the mount point, statistics for all mounted CacheFS file systems will be displayed.

Example--Viewing Cache Statistics


  $ cachefsstat /home/sam  
       cache hit rate: 73% (1234 hits, 450 misses)  
       consistency checks: 700 (650 pass, 50 fail)  
       modifies: 321  

The Cache Structure and Behavior

Each cache has a set of parameters that determine how it behaves and its structure. The parameters are set to default values which are listed in Table 36-3. The default values specify that the entire front file system is used for caching, which is the recommended method of caching file systems.
Table 36-3
Cache ParameterDefault ValueDefinition
maxblocks90%Sets the maximum number of blocks that CacheFS is allowed to claim within the front file system.
minblocks0%Sets the minimum number of blocks that CacheFS is allowed to claim within the front file system.
threshblocks85%Sets the number of blocks that must be available in the front file system before CacheFS can claim more than the blocks specified by minblocks.
maxfiles90%Sets the maximum number of available inodes (number of files) that CacheFS is allowed to claim within the front file system.
minfiles0%Sets the minimum number of available inodes (number of files) that CacheFS is allowed to claim within the front file system.
threshfiles85%Sets the number of inodes (number of files) that must be available in the front file system before CacheFS can claim more than the files specified in minfiles.
Typically, you should not change any of these parameter values. They are set to default values to achieve optimal cache behavior. However, you may want to modify the maxblocks and maxfiles settings if you have some room in the front file system that is not used by the cache, and you wish to use it for some other file system. You do this using the cfsadmin(1M) command. For example:

  $ cfsadmin -o maxblocks=60  

Consistency Checking of Cached File Systems With the Back File System

To ensure that the cached directories and files are kept up to date, CacheFS periodically checks consistency of files stored in the cache. To check consistency, CacheFS compares the current modification time to the previous modification time. If the modification times are different, all data and attributes for the directory or file are purged from the cache and new data and attributes are retrieved from the back file system.
When a user requests an operation on a directory or file, CacheFS checks if it is time to verify consistency. If so, CacheFS obtains the modification time from the back file system and performs the comparison.

Consistency Checking on Demand

By specifying the demandconst option of the mount(1M) command, consistency checks can be performed only when you explicitly request them for file systems mounted with this option. After specifying the demandconst option when you mount a file system in a cache, you use the cfsadmin(1M) command with the -s option to request a consistency check. By default, consistency checking is performed file by file as the files are accessed. If no files are accessed, no checks are performed. Use of the demandconst option will avoid the situation where the network is flooded with consistency checks. For more information about consistency checking on demand, refer to the cfsadmin(1M) command.