inactive=30d 与 open_file_cache_min_uses 8 表示如果在 30 天内某文件被访问的次数低于 8 次,那就将它从缓存中删除。 open_file_cache_valid 3m 表示每 3 分钟检查一次缓存中的文件元信息是否是最新的,如果不是则更新之。 一般建议配置为 open_file_cache max=10000inactive=30s; open_file_cache_valid ...
open_file_cache_valid 3m表示每 3 分钟检查一次缓存中的文件元信息是否是最新的,如果不是则更新之。 2 为什么只缓存文件元信息而不缓存文件内容? 这个问题的关键是 sendfile(2). Nginx 在 serve 静态文件的时候用的是 sendfile(2), 当然前提是你配置了sendfile on, sendfile(2) 直接在 kernel space 内传...
open_file_cache_valid 3m 表示每 3 分钟检查一次缓存中的文件元信息是否是最新的,如果不是则更新之。 1. 2. 3. 4. 5. 6. 7. 8. 9. 一般建议配置为 open_file_cache max=10000 inactive=30s; open_file_cache_valid 60s; open_file_cache_min_uses 2; open_file_cache_errors on; 1. 2. 3....
我们的open_file_cache指令 官方地址: http://nginx.org/en/docs/http/ngx_http_core_module.html#open_file_cache 代码语言:javascript 复制 句法: open_file_cache off;open_file_cache max=N[inactive=time];默认: open_file_cache off;语境: http,server,location 配置可以存储的缓存: 打开文件描述符,它...
open_file_cache_valid 30s; #这个是指多长时间检查一次缓存的有效信息。也就是说即使我一直访问这个文件,30s后会检查此文件的更改信息是否变化,发现变化就更新。 open_file_cache_min_uses 1; #指令中的inactive参数时间内文件的最少使用次数,如果超过这个数字,文件更改信息一直是在缓存中打开的。
NGINX的open_file_cache保存信息的快照。 由于信息在源处更改,快照可能在一段时间后无效。 open_file_ cache_valid指令定义时间段(以秒为单位),之后将重新验证open_file_cache中的元素。默认情况下,60秒后重新检查元素。 如下例子:NGINX将在非活动时间段之后从高速缓存中清除元素。 此指令可用于...
Nginx Open File Cache 2017-10-13 05:46 −Nginx 的 open_file_cache 相关配置可以缓存静态文件的元信息,在这些静态文件被频繁访问时可以显着提升性能。 被缓存的文件元信息包括: fd,文件被打开一次后,fd保留使用 size path last modified time … 这里有个配置示例: ope... ...
open_log_file_cache max=N [inactive=time] [min_uses=N] [valid=time]; 参数注释如下: max:设置缓存中的最大文件描述符数量,如果缓存被占满,采用LRU算法将描述符关闭。 inactive:设置存活时间,默认是10s min_uses:设置在inactive时间段内,日志文件最少使用多少次后,该日志文件描述符记入缓存中,默认是1次 ...
缓存日志文件的元数据
#define _NGX_ASYNC_OPEN_FILE_CACHE_H_INCLUDED_ typedef void(*ngx_async_open_file_callback_t)(void* context, ngx_int_t rc); ngx_int_t ngx_async_open_cached_file( ngx_open_file_cache_t *cache, ngx_str_t *name, ngx_open_file_info_t *of, ngx_pool_t *pool, ngx_thread_poo...