mod_statcache module is designed to cache the results
lstat(2) calls in shared memory,
so that the results can be shared among multiple session processes. On
a busy server, especially one handling many directory listings, these
lstat(2) calls can add quite a bit of
This module is contained in the
mod_statcache.c file for
ProFTPD 1.3.x, and is not compiled by default. Installation
instructions are discussed here. More examples
mod_statcache usage can be found here.
The most current version of
mod_statcache is distributed with the
ProFTPD source code.
Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.
StatCacheCapacity directive configures the capacity
of the cache, i.e. the maximum number of cache entries. By default,
mod_statcache allocates space for 5000 cache entries.
The count value be 10 or greater. The configured count is handled as a hint; the actual allocated capacity may be rounded up to the nearest multiple of the internal block sizes.
StatCacheControlsACLs directive configures access lists of
users or groups who are allowed (or denied) the ability to
use the actions implemented by
mod_statcache. The default
behavior is to deny everyone unless an ACL allowing access has been explicitly
If "allow" is used, then list, a comma-delimited list
of users or groups, can use the given actions; all
others are denied. If "deny" is used, then the list of
users or groups cannot use actions all others are
StatCacheControlsACLs directives may be used to
configure ACLs for different control actions, and for both users and groups.
The action provided by
# Allow only user root to examine cache stats StatCacheControlsACLs all allow user root
StatCacheEngine directive enables or disables the module's
StatCacheMaxAge directive configures how long the
mod_statcache module will keep the
lstat(2) results cached for a given path. By default,
mod_statcache will cache results for 5 seconds (and will
lstat(2) calls for
If you configure a single age parameter, then that value will be used for both positive and negative cache entries. Thus:
StatCacheMaxAge 300will cache successful and failed
lstat(2)calls for 5 minutes (300 seconds).
To disable caching of failed
entirely, use a negative-cache-age value of zero, e.g.:
# Cache lookups for 60 seconds, and do not cache failed lookups StatCacheMaxAge 60 0
StatCacheTable directive configures a path to a file
mod_statcache uses for handling its cache data. The given
path must be an absolute path. Note: this directive is
mod_statcache to function. It is recommended
that this file not be on an NFS mounted partition.
Note that statcache data is not kept across daemon stop/starts. That is,
proftpd is shutdown, all current statcache data is lost.
statcache action is used to display cache statistics about
the statcache data maintained by
mod_statcache. For example:
# ftpdctl statcache info ftpdctl: hits 773, misses 67: 92.0% hit rate ftpdctl: expires 22, rejects 0 ftpdctl: current count: 1 (of 5000) (0.0% usage) ftpdctl: highest count: 45 (of 5000) (0.9% usage)To dump out the entire cache contents (not recommended on a busy server), you can use:
# ftpdctl statcache dump
mod_statcachemodule is distributed with ProFTPD. For including
mod_statcacheas a staticly linked module, use:
$ ./configure --with-modules=mod_statcacheTo build
mod_statcacheas a DSO module:
$ ./configure --enable-dso --with-shared=mod_statcacheThen follow the usual steps:
$ make $ make install
For those with an existing ProFTPD installation, you can use the
prxs tool to add
mod_statcache, as a DSO module, to
your existing server:
$ prxs -c -i -d mod_statcache.c
Note: Use of the
mod_statcache module will
interfere with the
mod_statcache module works by allocating a SysV shared
memory segment. The different
proftpd session processes
then attach to that shared memory segment so that they can share statcache
<IfModule mod_statcache.c> StatCacheEngine on StatCacheTable /var/run/proftpd/statcache.tab </IfModule>