comparison src/http/ngx_http_cache.h @ 6795:1a917932db96

Cache: prefix-based temporary files. On Linux, the rename syscall can be slow due to a global file system lock, acquired for the entire rename operation, unless both old and new files are in the same directory. To address this temporary files are now created in the same directory as the expected resulting cache file when using the "use_temp_path=off" parameter. This change mostly reverts 99639bfdfa2a and 3281de8142f5, restoring the behaviour as of a9138c35120d (with minor changes).
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 03 Nov 2016 17:10:29 +0300
parents adc2414856b1
children 9a9e13686869
comparison
equal deleted inserted replaced
6794:93b294c5d581 6795:1a917932db96
149 struct ngx_http_file_cache_s { 149 struct ngx_http_file_cache_s {
150 ngx_http_file_cache_sh_t *sh; 150 ngx_http_file_cache_sh_t *sh;
151 ngx_slab_pool_t *shpool; 151 ngx_slab_pool_t *shpool;
152 152
153 ngx_path_t *path; 153 ngx_path_t *path;
154 ngx_path_t *temp_path;
155 154
156 off_t max_size; 155 off_t max_size;
157 size_t bsize; 156 size_t bsize;
158 157
159 time_t inactive; 158 time_t inactive;
169 ngx_uint_t manager_files; 168 ngx_uint_t manager_files;
170 ngx_msec_t manager_sleep; 169 ngx_msec_t manager_sleep;
171 ngx_msec_t manager_threshold; 170 ngx_msec_t manager_threshold;
172 171
173 ngx_shm_zone_t *shm_zone; 172 ngx_shm_zone_t *shm_zone;
173
174 ngx_uint_t use_temp_path;
175 /* unsigned use_temp_path:1 */
174 }; 176 };
175 177
176 178
177 ngx_int_t ngx_http_file_cache_new(ngx_http_request_t *r); 179 ngx_int_t ngx_http_file_cache_new(ngx_http_request_t *r);
178 ngx_int_t ngx_http_file_cache_create(ngx_http_request_t *r); 180 ngx_int_t ngx_http_file_cache_create(ngx_http_request_t *r);