30.3 Setting the Cache Balance

The cache performance statistics are divided into system cache and user cache. System data is everything that is not user data. It includes the roll-back ZLOG (journal), the roll-forward Purge Log, and the various databases and structures where NSS keeps information about files—for example, the name tree, the beast tree, and the visibility list.

If user data from cached files leaves no space for the system data, the file system performance might suffer. Under normal circumstances, you should see a 98% hit rate for both user data cache and system data cache. In some cases a lower cache rate is normal—for example, in situations where backups have run, or when large file copies have just occurred, or in a business that deals with large files that consistently flush the cache. If you want to raise the cache statistics in these situations, you need to dedicate more RAM to NSS.

A cache buffer is 4 KB block of RAM that temporarily stores data. When you install NSS, it consumes 85% of the cache buffers by default. The following NSS parameters can be used to adjust the cache balance between user and system data. You can set or tune cache buffers at anytime.

nss /AuthCacheSize=value

Set the number of authorization cache entries.

This specifies the number of cache buffers to be used to speed up authorization requests.

If many trustees are set on different files and directories, we recommend that you increase this number to at least 20000.

Default: 1024

Range: 16 to 50000

nss /CacheBalance=value

Set the amount of cache that NSS takes from the file system. A low cache balance impedes the performance of NSS.

Every 30 seconds (by default) or whenever the server loads an NLM™, NSS rebalances the NSS file system cache to the percentage specified by the CacheBalance parameter. This command enables the dynamic balancing of free memory for the NSS buffer cache, and sets the specified percentage of free kernel memory that NSS uses for its buffer cache.

NOTE:You can change the default time interval with the CacheBalanceTimer option.

Default: 85

Range: 1 to 99

The default is On. Use this command in combination with the /MinBufferCacheSize switch.

nss /NoCacheBalance

Disables the dynamic balancing of free memory for the NSS buffer cache.

nss /CacheBalanceMaxBuffersPerSession=value

Set a maximum amount of memory to transfer to NSS during a cache balancing session.

Usually when the CacheBalance is recalculated, a small amount of RAM is either given or taken away from the NSS cache. This parameter controls the maximum cache balance transfer (in the number of 4 KB cache buffers) given to the NSS file system cache per cache balance.

If your server has applications running on it that can consume significant amounts of RAM for a short period of time, you might want to increase this parameter. Otherwise your server may take several minutes to get back to the correct amount of cache dictated by the CacheBalance parameter.

This parameter does not affect memory requests made of NSS by the OS. For example, if NSS is asked to give back 5 MB of RAM, it complies at the time of the request in one transfer.

Default: 1024

Range: 16 to memory size in KB/4 KB

nss /CacheBalanceTimer=value

Determine how often NSS rebalances the amount of cache it uses.

This lets you determine how often (in seconds) NSS rebalances the amount of cache it uses according to the total amount of memory on the server.

If you have difficulty loading NLM programs because of low memory, you might want to lower this timer setting. A lower setting forces NSS to rebalance more often. If your server is stable, you might want to increase this timer so NSS does not work as hard; this ensures that the cache remains balanced. NSS monitors the total number of cache buffers to determine if the CacheBalance percentage is met. It then adjusts the timer to provide the appropriate number of cache buffers.

Default: 30

Range: 1 to 3600

nss /CacheHit

Show the cache hit ratio at the server console.

This is the number of cache hits divided by the number of attempts to get a file cache buffer from the cache. Any amount above 90% is good. This means the system is spending less time going to the disk to retrieve data.

Cache hit is the number of times that NSS finds the desired file block in the cache buffers. Lower numbers indicate that NSS needs more memory.

If you allocate more memory to NSS, the cache hit percentage increases. You can add more memory by adding more physical memory, increasing the cache balance, or increasing the minimum number of cache buffers for NSS. We do not recommend lowering the minimum number of OS cache buffers.

CacheStats (or nss /CacheStats)

Show cache buffer statistics.

nss /CacheUserMaxPercent=value

Control the division of the file system cache between user and system data.

Sets the specified maximum percentage of buffer cache that can be used for user data.

If you have a server with a few files and volume attributes and a generous amount of cache RAM, you can increase this parameter.

Default: 80

Range: 10 to 100

nss /MinBufferCacheSize=value

Set the number of cache buffers allocated for NSS.

This sets the minimum number of 4 KB cache buffers allocated for NSS file system access. Make sure this value is at least 10000 unless you also have NetWare traditional volumes on your system.

Default: 512

Range: 256 to memory size in KB/ 4 KB

On a server with only NSS volumes, you can adjust the CacheBalance parameter to 85% without any problem. However, you should monitor the Least Recently Used (LRU) Sitting Time on the NetWare server to ensure that you are not running the server too low on memory.

To safeguard against this, use the MinOSBufferCacheSize option to set a hard limit for the amount of RAM that can be used exclusively by the operating system.

HINT:LRU Sitting Time is found in the Monitor utility under Disk Cache Utilization. Under normal circumstances, the server should be up for over 24 hours, so this statistic should only be below 24 hours right after a reboot.

nss /MinOSBufferCacheSize=value

Set a minimum amount of RAM exclusively for the operating system.

If you allocate too much memory to your NSS cache, the server can run out of memory. To prevent this, set aside a minimum number of 4 KB cache buffers for the exclusive use of the server operating system. Recommended is 20000.

Default: 256

Range: 256 to memory size in KB/4 KB

nss /reset

Reset cache statistics to clear the current statistics and start over. This is useful when checking the results of changes to the system.