Project

General

Profile

Actions

Server stat-cache-engineDetails » History » Revision 9

« Previous | Revision 9/11 (diff) | Next »
gstrauss, 2020-11-04 10:07


server.stat-cache-engine option

stat() system call caching; lighttpd can utilize FAM/Gamin to cache stat call.

possible values are: "disable", "simple", "fam", "inotify", or "kqueue".

  • "disable"
    no stat() call is cached (a single request might result in 3-4 stat() calls)
    If your files are changing in size a lot, you might have to have the stat-cache
    disabled
  • "simple" (default; recommended)
    cache each stat() call for one second.
  • "fam"
    if FAM or gamin are installed and lighty is linked against those libraries you
    can use them to control the freshness of the stat-cache.
  • "inotify" (since lighttpd 1.4.56)
    On Linux, inotify() is used instead of FAM or gamin (which use inotify() on Linux)
  • "kqueue" (since lighttpd 1.4.56)
    On *BSD, kqueue() is used instead of FAM or gamin (which use kqueue() on *BSD)

Example

server.stat-cache-engine = "simple" 

Limitations

Caches have limitations. There have always been limitations with lighttpd stat_cache. lighttpd stat_cache only monitors directories. lighttpd stat_cache is notified about additions and removals of files within a monitored directory but depending on the OS implementation of FAM or gamin (e.g. inotify or kqueue), lighttpd might not be notified of changes on files within a directory such as timestamps (touch), ownership, or even changes in contents (e.g. if a file is edited through a hard link).

server.stat-cache-engine = "disable" should be used when files should not be cached. Full stop. Similarly, "disable" is recommended if files change frequently. If using server.stat-cache-engine with any engine, there are caching effects and tradeoffs.

On *BSD and using kqueue() on directories, any change reported results in clearing the stat_cache of all entries for that directory, since monitoring only the directory does not indicate which file was added or removed. This is not efficient for directories containing frequently changed files.

See Also

Updated by gstrauss about 4 years ago · 9 revisions