Project

General

Profile

Server stat-cache-engineDetails » History » Revision 10

Revision 9 (gstrauss, 2020-11-04 10:07) → Revision 10/11 (gstrauss, 2020-11-05 01:26)

h2. 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) 


 h3. Example 

 <pre> 
 server.stat-cache-engine = "simple" 
 </pre> 


 h2. Limitations 

 Caches have limitations.    There have always been limitations with lighttpd stat_cache.    If using @server.stat-cache-engine@ with any engine, there are caching effects and tradeoffs.    Still, for typical use cases @server.stat-cache-engine = "simple"@ is recommended. 

 lighttpd stat_cache monitor only monitors directories with @"fam"@, @"inotify"@, or @"kqueue"@. directories.    If a path is a symlink to a directory, lighttpd monitors the target of the symlink, the directory, so do not use @server.follow-symlink = "disable"@ with @server.stat-cache-engine@ set to @"fam"@, @"inotify"@, or @"kqueue"@. 

 lighttpd stat_cache monitor 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. 


 h2. See Also 


 * [[lighttpd:Docs_Performance#stat-cache|Performance: Stat Cache]]