Quote from Apache Module.
mod_file_cachecaches a list of statically configured files viaMMapFileorCacheFiledirectives in the main server configuration.Not all platforms support both directives. For example, Apache on Windows does not currently support the
MMapStaticdirective, while other platforms, like AIX, support both. You will receive an error message in the server error log if you attempt to use an unsupported directive. If given an unsupported directive, the server will start but the file will not be cached. On platforms that support both directives, you should experiment with both to see which works best for you.MMapFile Directive
The
MMapFiledirective ofmod_file_cachemaps a list of statically configured files into memory through the system callmmap(). This system call is available on most modern Unix derivates, but not on all. There are sometimes system-specific limits on the size and number of files that can bemmap()ed, experimentation is probably the easiest way to find out.This
mmap()ing is done once at server start or restart, only. So whenever one of the mapped files changes on the filesystem you have to restart the server (see the Stopping and Restarting documentation). To reiterate that point: if the files are modified in place without restarting the server you may end up serving requests that are completely bogus. You should update files by unlinking the old copy and putting a new copy in place. Most tools such asrdistandmvdo this. The reason why this modules doesn't take care of changes to the files is that this check would need an extrastat()every time which is a waste and against the intent of I/O reduction.CacheFile Directive
The
CacheFiledirective ofmod_file_cacheopens an active handle or file descriptor to the file (or files) listed in the configuration directive and places these open file handles in the cache. When the file is requested, the server retrieves the handle from the cache and passes it to thesendfile()(orTransmitFile()on Windows), socket API.This file handle caching is done once at server start or restart, only. So whenever one of the cached files changes on the filesystem you have to restart the server (see the Stopping and Restarting documentation). To reiterate that point: if the files are modified in place without restarting the server you may end up serving requests that are completely bogus. You should update files by unlinking the old copy and putting a new copy in place. Most tools such as
rdistandmvdo this.
References:
1. Apache Module mod_file_cache
http://httpd.apache.org/docs/2.0/mod/mod_file_cache.html
No comments:
Post a Comment