comparison src/http/ngx_http_upstream.c @ 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 93b294c5d581
children d8d037f20484
comparison
equal deleted inserted replaced
6794:93b294c5d581 6795:1a917932db96
2995 2995
2996 if (p->cacheable) { 2996 if (p->cacheable) {
2997 p->temp_file->persistent = 1; 2997 p->temp_file->persistent = 1;
2998 2998
2999 #if (NGX_HTTP_CACHE) 2999 #if (NGX_HTTP_CACHE)
3000 if (r->cache && r->cache->file_cache->temp_path) { 3000 if (r->cache && !r->cache->file_cache->use_temp_path) {
3001 p->temp_file->path = r->cache->file_cache->temp_path; 3001 p->temp_file->path = r->cache->file_cache->path;
3002 p->temp_file->file.name = r->cache->file.name;
3002 } 3003 }
3003 #endif 3004 #endif
3004 3005
3005 } else { 3006 } else {
3006 p->temp_file->log_level = NGX_LOG_WARN; 3007 p->temp_file->log_level = NGX_LOG_WARN;