Sun Java System Web Proxy Server 4.0.8 Administration Guide

Using the Cache Command-Line Interface

The proxy server comes with several command-line utilities that enable you to configure, change, generate, and repair your cache directory structure. Most of these utilities duplicate the functionality of the Server Manager pages. You might want to use the utilities if you need to schedule maintenance, for example, as a cron job. All of the utilities are located in the extras directory.

ProcedureTo Run the Command-Line Utilities

  1. From the command-line prompt, go to the server_root/proxy-serverid directory.

  2. Type ./start -shell

    The following sections describe the various utilities.

Building the Cache Directory Structure

The proxy utility called cbuild is an offline cache database manager. This utility enables you to create a new cache structure or modify an existing cache structure using the command-line interface. You can use the Server Manager pages to enable the proxy to use the newly created cache.


Note –

The utility does not update the server.xml file. cbuild cannot resize a cache that has multiple partitions. When the cache is created or modified by cbuild, the cachecapacity parameter should be manually updated in the server.xml file.

<PARTITION partitionname="part1" partitiondir="/home/build/install9
/proxy-server1/cache" maxsize="1600" minspace="5" enabled="true"/>
<CACHE enabled="true" cachecapacity="2000" cachedir="/tmp/cache">

You can invoke the cbuild utility in two modes. The first mode is:

cbuild -d conf-dir -c cache-dir -s cache size 
cbuild -d conf-dir -c cache-dir -s cache size -r

For example:

cbuild -d server_root/proxy-serverid/config 
	-c server_root/proxy-serverid/cache -s 512
cbuild -d server_root/proxy-serverid/config 
	-c server_root/proxy-serverid/cache -s 512 -r

where

The second mode is:

cbuild -d conf-dir -c cache-dir -n cache-dim
cbuild -d conf-dir -c cache-dir -n cache-dim -r

For example:

cbuild -d server_root/proxy-serverid/config 
	-c server_root/proxy-serverid/cache -n 3
cbuild -d server_root/proxy-serverid/config 
	-c server_root/proxy-serverid/cache -n 3 -r

where

Managing the Cache URL List

The proxy utility urldb manages the URL list in the cache. You can use this utility to list the URLs that are cached. You can also selectively expire and remove cached objects from the cache database.

The urldb commands can be categorised into three groups based on the -o option:

Managing Cache Garbage Collection

The cachegc utility enables you to remove objects from the cache database that might have expired or are too old to be cached due to cache size constraints.


Note –

Ensure that the CacheGC is not running in the proxy instance when the cachegc utility is used.


The cachegc utility can be used in the following way:

cachegc -f leave-fs-full-percent -u gc-high-margin-percent -l gc-low-margin-percent -e 
	extra-margin-percent -d conf-dir

For example:

cachegc -f 50 -u 80 -l 60 -e 5 -d server-root/proxy-serverid/config

where

Managing Batch Updates

The bu utility updates the cache and works in two modes. In the first mode, it iterates through the cache database and updates all the URLs that are present in the cache by sending HTTP requests for each. In the second mode, it starts with a given URL and does a breadth first iteration of all the links from that URL to the depth that you specify and fetches pages to the cache. bu is a RFC compliant robot.

bu -n hostname -p port -t time-lmt -f contact-address -s sleep-time -o object -r n -d conf-dir

For example:

bu -n phoenix -p 80 -t 3600 -f admin@phoenix.com -s 60 -o nova -r n 
	-d server-root/proxy-serverid/config

where