1.2 Caching

A cache is a temporary, quickly accessible area in RAM that stores frequently used information from the hard disk. NetWare uses caching to increase the speed of reads and writes on server hardware. As long as a block of data stays in RAM, NetWare can access it much faster than accessing data on the disk.

A cache hit means that the server found the data in RAM rather than needing to go to disk. This provides a large performance increase.

Having sufficient RAM to cache disk data results in a high percentage of cache hits. The more NLM programs and other services you load, the less RAM the server has available for caching data. This lowers your cache hit percentage and slows network performance. For information on disk cache utilization, see Tuning Server Memory.

When data is stored in cache, it is stored in 4 KB blocks called cache buffers. Recently used data is kept in cache buffers in case it is needed again.

The following sections include information about how cache memory is used in these systems and services:

1.2.1 Traditional File System

Cache memory is used for all the server’s processing needs, such as the following:

  • Storing volume File Allocation Tables (FAT) and suballocation tables

  • Storing volume directory entry tables

  • Storing user data files

  • Storing NLM programs, such as LAN drivers, disk drivers, and management utilities

  • Building hash tables for directory names

  • Creating protected address spaces

  • Allocated memory used by NLM programs

  • Name cache and file cache

Figure 1-1 Disk Cache Allocation Example

Memory from cache is allocated to an NLM program when requested. When an NLM program is finished using the memory, it releases the memory and returns it to cache. NetWare also provides a garbage collection process to recover unused memory.

1.2.2 Novell Storage Services

Beginning with NetWare 6.5, Novell® Storage Services™ (NSS) is always loaded on the server in order to run and cache memory is always allocated. NSS uses memory differently than the Traditional file system. Some of these differences are the following:

  • NSS caches files larger than 128 KB in the memory above 4 GB. This improves performances for these files and for smaller files because they do not compete for the same memory.

  • NSS has its own cache blocks, although they are counted as total free blocks in the system. The memory allocator can use them for applications other than NSS.

  • By default, NSS maintains the Closed File Cache Size parameter at 100,000. Each cache is about 1 KB, so 100 MB of memory is eventually dedicated to Closed File Cache Size. NSS does not automatically allocate 100 MB of memory for this parameter; it waits for 100,000 files to close before it reaches 100 MB.

    If the server detects that it needs more memory, some of this 100 MB is automatically sent to the free pools. NSS adjusts itself as pressure on the memory system increases. For more information about this parameter, see Cache Hit Percentage.

You must use specific parameters for tuning your server when using NSS. For more information, see Tuning File Cache.

1.2.3 Directory Buffers and File Cache Buffers

There are two kinds of cache: directory cache and file cache.

Directory cache is used only with the Traditional NetWare file system, not with the Novell Storage Services (NSS) file system. The directory cache is a percentage of the file cache assigned to the Traditional file system. Directory cache stores disk directory entries. When the server is first installed, NetWare allocates 20 directory cache buffers of 4 KB each. If more buffers are needed, NetWare tunes the server by increasing the number of directory cache buffers.

You can tune the number of directory cache buffers yourself, using two server parameters that establish the minimum and maximum number of directory cache buffers the server can allocate. For information about tuning directory cache, see Tuning Directory Cache for the Traditional File System.

File cache is used with both the Traditional file system and the NSS file system. File cache is a pool of 4 KB memory pages that stores recently used file data.

In an ideal environment, there is enough memory so that all frequently used data can be retrieved from file cache rather than from disk.

Monitoring the disk cache utilization statistic can help you estimate whether your server has sufficient memory to service requests from cache. For information about optimizing file cache, see Tuning File Cache.

If you are using both Novell Storage Services (NSS) and the Traditional file system, you want to tune both the file and directory caches.If you are using just the Traditional file system, you should tune only the directory cache.

1.2.4 Garbage Collection

NetWare uses memory deallocation and garbage collection to collect previously allocated but currently unused segments of memory and return them to a common memory pool. Garbage collection is used by the Traditional file system only.

Garbage collection is triggered by demand on the virtual memory system. The virtual memory system is checked every 10 seconds. For an explanation of virtual memory, see Virtual Memory.

If virtual memory is being used heavily, garbage collection happens immediately. If virtual memory usage is low, garbage collection happens according to the following process:

  1. A process named Free labels the memory as deallocated.

  2. The garbage collection process recovers the pieces of deallocated memory and returns them to the memory pool.

The garbage collection is interruptible, can run in the background, and should run frequently. You can manually initiate the process if needed. See Optimizing Garbage Collection.