Advanced Status
Introduction
The cache status page (Web Controller -> Clustering -> machine -> Advanced status) provides detailed information on the internal state of the web server. This information can be extremely useful in tuning the web server for the highest performance in your environment.
Here is an example of the output:
child: id: 0 cachestatus: cryptcache: No cache statcache: lrucache: entries: 12674 hits: 524755 buckets: 98041 lookups: 537429 expire: 31536000 numexpired: 0 frequency: 86447 10528 1052 14 0 0 0 0 0 0 0 0 0 0 0 meminfomapping: lrucacheref: entries: 10699 hits: 365886 buckets: 98041 lookups: 385178 numpinned: 0 frequency: 88079 9234 719 9 0 0 0 0 0 0 0 0 0 0 0 pwhashcache: No cache fdinfomapping: No cache pid: 1511 child: id: 1 cachestatus: statcache: lrucache: hits: 932993 entries: 12674 buckets: 98041 lookups: 945667 expire: 31536000 numexpired: 0 frequency: 86447 10528 1052 14 0 0 0 0 0 0 0 0 0 0 0 cryptcache: No cache meminfomapping: lrucacheref: hits: 651431 entries: 10017 buckets: 98041 lookups: 671318 numpinned: 0 frequency: 88635 8805 591 10 0 0 0 0 0 0 0 0 0 0 0 pwhashcache: No cache fdinfomapping: No cache pid: 1512The example above was taken from a twin-CPU machine which was running to zeus.web child processes, hence the results were reported for each child.
Command line invocation
This cache information may also be retrieved using the command line tool $ZEUSHOME/webadmin/bin/cacheinfo. The advantage of using the command line version is the ability to script its execution, for example, you may wish to run the cacheinfo program periodically on a cronjob to monitor the behavior in caching effectiveness over a period of time.
cacheinfo, like all Zeus management tools, is fully cluster aware, and can retrieve the cache information from any machine in the cluster.
Usage:
cacheinfo [machinename]Where [machinename] is a valid machine in the web server cluster, (for example, 'localhost'). (To retrieve a list of valid machine names, use the webctl program as follows: webctl --action=list).
Cache Descriptions
- statcache
- The statcache contains meta-data about file information, such as the data returned from the OS stat() call. This information is used for example to determine if files have been modified.
- meminfomapping
- The meminfomapping cache contains files cached in memory by Zeus, either via mmap() or via malloc().
- fdinfomapping
- The fdinfomapping cache contains open file descriptors of regularly requested files to improve sendfile() performance. This cache is only used when sendfile() is available/configured.
- pwhashcache
- The pwhashcache contains frequently MD5()ed passwords used for authenticating users against the access module.
- cryptcache
- The cryptcache contains frequently crypt()ed passwords used for authenticating users against the htaccess module.
Cache internals
The cache sections provide data on each of Zeus's internal caches. For each cache the following information is available:
- buckets
- Caches are organized using a hash-table data structure. A larger number of buckets allows more data to be stored and retrieved efficiently in the cache. Using a prime number can improve the distribution of requests across the buckets, but can make each lookup/insert take longer; see the frequency results for distribution details.
- entries
- The number of entries currently in the cache.
- lookups
- This records the number of times the web server has tried to lookup a value in this cache.
- hits
- This records the number of lookups that successfully retrieved a cached result. The ratio of number of hits versus number of lookups gives you a measure of the cache effectiveness. If this ratio is small, then increasing the cache size may help, or it may be that the workload provided is non-cacheable (no repeated requests).
- frequency
- This reports the distribution of chain lengths from each bucket. When an entry is put into the cache, a 'random' bucket is chosen, and the entry inserted into the chain of entries hanging off that bucket. In a perfect table, all entries would be as evenly distributed as possible, so all the chain lengths should be small. The frequency figures consist of 15 numbers. The first number is the number of empty buckets, the second number is the number of buckets with 1 entry, the third number is the number of buckets with 2 entries as so on. If the last few numbers are not zero, then the cache is performing badly for the given workload.
The following entries are optional depending on the type of cache:
- expire
- The expiry time for entries in the cache (in seconds). Any entry that has been in the cache for more than this period of time is considered expired (and effectively no longer in the cache).
- numexpired
- The number of entries present in the cache that are older than the expire time.
- numpinned
- For some caches, data can be looked up and used immediately, for other caches, data may be large and used for a substantial period of time. In the latter case, data is pinned down in the cache while it is in use, during which time new data will not replace it. The numpinned reading reports the number of entries that are currently in-use/pinned down in this way.