Configuring basic caching

If you used the default settings in the Edge components Product Setup Program to install Caching Proxy, caching is enabled and the cache is stored in memory.

You can adjust the following basic cache settings to customize the cache for the needs of your system.

If you did not use the setup program, configure these settings to enable caching.

The following basic steps are necessary to configure caching:
  1. Enable caching.
  2. Configure cache storage.
After configuring basic cache settings, you can add or change settings for the following features.
  • Customize cache memory.
  • Save or load cache memory to disk.
  • Restrict what is cached by using URL filters.
  • Expand what is cached by enabling caching for query results or dynamically generated files.
  • Configure cached file expiration and garbage collection.
  • Configure automatic cache refresh and preinstall.
  • Configure cache sharing with remote cache access (RCA) or Internet caching protocol (ICP).
  • Configure logging.

Enable caching

To enable caching, set the Caching directive to on, or check the Enable proxy caching box on the Cache Configuration –> Cache Settings configuration form. If you do not specify a cache device, the cache is stored in memory.

Configure cache storage

The tasks for configuring cache storage depend on whether you use a memory cache or a disk cache.

To use a memory cache, customize the Cache Memory setting so that it includes enough memory to hold the contents of a cache.

To use a disk cache, you must do the following:
  1. Prepare a storage device to hold the cache.

    The cache requires a specially formatted device. Devoting an entire device or disk partition to the cache is suggested. The minimum size for a cache is 16392 KB.

    To format the cache device:
    1. Choose a device to hold the cache. Ensure that no other program is using that storage space and that the device can be accessed as a raw (or character-formatted) device.
    2. Format the device by using the htcformat command. The syntax is as follows:
      htcformat 
                                       raw_device_path
                                     [-blocksize 
                                       block_size
                                    ]
           [-blocks 
                                       number_of_blocks
                                    ]
      The -blocksize and -blocks arguments are optional. The default block size is 8192 bytes. If the number of blocks is not specified, the disk partition is filled with as many blocks as it can contain.
      When specifying the device path, be sure to specify the raw device path.
      • On AIX® operating systems, the raw device path for a logical volume that is defined as /dev/lv02 is /dev/rlv02
      • On Linux® operating systems, you must first run the raw command before running htcformat to associate the raw device path with the real SCSI drive sdb1.
        raw /dev/raw/raw1 dev/sdb1
      • On HP-UX and Solaris operating systems, the raw device path for a partition that is defined as /dev/dsk/c0t0d0s0 is /dev/rdsk/c0t0d0s0
      • On Windows operating systems, the raw device path for a device that is defined as e: is \\.\e:
  2. Specify the cache device by using the CacheDev directive or the Cache Settings configuration form. You can specify more than one device.
CAUTION:
On Windows systems, the htcformat command does not automatically mark the cache device as unwritable.

If the operating system attempts to write to the cache device, cached data can be lost. To avoid this from happening, you can use the Windows Disk Manager utility to prepare the disk before using the htcformat command. To prepare the disk, use the disk utility to delete the device or partition you want to use, then re-create it without formatting it. This causes the system to consider the device unavailable for system storage.

Optional customizations

Set cache memory

Set the value in the CacheMemory directive (or in the Cache Memory field of the Cache Settings configuration form), according to the following principles. The amount of memory set in this value is used for cache infrastructure support, including the cache index, and, if memory caching is configured, to store the contents of the cache.

Minimum values

For optimum performance of disk caches, a minimum cache memory value of 64 MB is suggested for cache infrastructure support, including the cache index. As the cache size increases, the cache index increases, and more cache memory is required to store the index. A cache memory value of 64 MB is large enough to provide cache infrastructure support and store a cache index for a disk cache of up to approximately 6.4 GB. For larger disk caches, the cache memory should be 1% of the cache size.

For memory caches, the cache memory value is the amount of memory set aside for the cache infrastructure support and the cache itself. A minimum cache memory value of 64 MB is suggested.

Maximum value

If too much physical memory is allocated for a memory cache, undesirable operations such as out of memory errors or proxy server failures can possibly occur. The value limitations for cache memory are due to the limitations of a 32-bit application. Because Caching Proxy is a 32-bit application. It can use a maximum of 2 GB of memory.

Caching Proxy allocates the memory that is defined by the CacheMemory directive and uses it as the cache to store objects. More memory must be allocated, whether it is a memory cache or a raw disk cache, for data structures for the cache, network I/O and connection buffers, session buffers, and memory for the main process and for all the threads. Furthermore, it is possible that requests from some clients might need to allocate a larger memory pool block than the default. Therefore, if the CacheMemory directive is set close to the 2 GB mark, it is possible that Caching Proxy might not have enough memory to operate, especially under high request loads.

It is suggested that the value of the CacheMemory directive be less than or equal to 1600 MB. Setting the value higher than 1600 MB interferes with the memory that Caching Proxy needs for its normal operation, and causes adverse side effects. These side effects typically include but are not limited to increased CPU usage (possibly up to 100% usage), out-of-memory errors, and sluggish performance. If an overall larger cache size is required, use cache devices or implement a shared cache configuration with RCA or ICP.

Save or load cache memory to disk

You can import and export cache contents to or from a dump file. This is useful when cache memory gets lost during restart, or when deploying the same cache for multiple proxies.

Set caching filters

Filters can restrict what is cached by matching the form of the URL request.

Configure caching for query results and dynamically generated files

Optionally, you can configure the proxy server to cache results of query requests. By default, URLs that contain a question mark (?) are not cached.

Another option is to cache results of servlet or JSP execution from an IBM® WebSphere® Application Server.

Configure file expiration and garbage collection

Refer to Maintaining cache content for information about configuring when files in the cache expire and how obsolete files are removed.

Configure automatic preloading

The cache can be configured to automatically refresh the most popular files daily, before they are requested.

Configure cache sharing

Under certain circumstances, using a shared cache increases the likelihood that a requested file is found in the cache.