Opened 6 months ago

Last modified 6 months ago

#2642 new defect

proxy_cache_revalidate seems to prevent the cache manager to remove inactive cache objects

Reported by: teodorescuserban@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.22.x
Keywords: cache Cc:
uname -a: Linux test-server 4.14.343-261.564.amzn2.x86_64 #1 SMP Tue May 7 02:23:34 UTC 2024 x86_64 Linux
nginx -V: nginx version: nginx/1.22.1
built with OpenSSL 3.0.5 5 Jul 2022 (running with OpenSSL 3.0.8 7 Feb 2023)
TLS SNI support enabled
configure arguments: --prefix=/var/lib/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/ngin
x/nginx.conf --pid-path=/run/nginx/nginx.pid --lock-path=/run/nginx/nginx.lock --http-client-body-temp-path=/var/lib/nginx/tmp/clien
t_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/v
ar/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --with-perl_modules_path=/usr/lib/perl5/vendor_perl --user=ngin
x --group=nginx --with-threads --with-file-aio --without-pcre2 --with-http_ssl_module --with-http_v2_module --with-http_realip_modul
e --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynam
ic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http
_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degra
dation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mai
l_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-st
ream_ssl_preread_module --add-dynamic-module=/home/buildozer/aports/main/nginx/src/njs-0.7.7/nginx --add-dynamic-module=/home/buildo
zer/aports/main/nginx/src/ngx_devel_kit-0.3.1/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/traffic-accounting-nginx-m
odule-2.0/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/array-var-nginx-module-0.05/ --add-dynamic-module=/home/buildo
zer/aports/main/nginx/src/ngx_brotli-1.0.0rc/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/ngx_cache_purge-2.5.2/ --ad
d-dynamic-module=/home/buildozer/aports/main/nginx/src/nginx_cookie_flag_module-1.1.0/ --add-dynamic-module=/home/buildozer/aports/m
ain/nginx/src/nginx-dav-ext-module-3.0.0/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/echo-nginx-module-0.63/ --add-d
ynamic-module=/home/buildozer/aports/main/nginx/src/encrypted-session-nginx-module-0.09/ --add-dynamic-module=/home/buildozer/aports
/main/nginx/src/ngx-fancyindex-0.5.2/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/ngx_http_geoip2_module-3.4/ --add-d
ynamic-module=/home/buildozer/aports/main/nginx/src/headers-more-nginx-module-0.34/ --add-dynamic-module=/home/buildozer/aports/main
/nginx/src/nginx-log-zmq-1.0.0/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/lua-nginx-module-0.10.22/ --add-dynamic-m
odule=/home/buildozer/aports/main/nginx/src/lua-upstream-nginx-module-0.07/ --add-dynamic-module=/home/buildozer/aports/main/nginx/s
rc/naxsi-1.3/naxsi_src --add-dynamic-module=/home/buildozer/aports/main/nginx/src/nchan-1.3.4/ --add-dynamic-module=/home/buildozer/
aports/main/nginx/src/redis2-nginx-module-0.15/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/set-misc-nginx-module-0.3
3/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/nginx-http-shibboleth-2.0.1/ --add-dynamic-module=/home/buildozer/apor
ts/main/nginx/src/ngx_http_untar_module-1.1/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/nginx-upload-module-2.3.0/ -
-add-dynamic-module=/home/buildozer/aports/main/nginx/src/nginx-upload-progress-module-0.9.2/ --add-dynamic-module=/home/buildozer/a
ports/main/nginx/src/nginx-upstream-fair-0.1.3/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/ngx_upstream_jdomain-1.4.
0/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/nginx-vod-module-1.30/ --add-dynamic-module=/home/buildozer/aports/mai
n/nginx/src/nginx-module-vts-0.2.1/ --add-dynamic-module=/home/buildozer/aports/main/nginx/src/mod_zip-1.2.0/ --add-dynamic-module=/
home/buildozer/aports/main/nginx/src/nginx-rtmp-module-1.2.2/

Description (last modified by teodorescuserban@…)

My config:

http {
...
proxy_cache_path /srv/cache/nginx_cache levels=1:2 keys_zone=cache:128m max_size=2048m inactive=10m;
...
server {
location / {
...
proxy_cache_valid 200 1m;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_cache_background_update on;
proxy_cache_revalidate on;
...
}
...
}
...
}

Everything working as expected, but no files are removed from the disk cache.
The backend is not actually capable of honouring the revalidate mechanism just yet but I added it in there to be ready when needed.

Since I clearly remembered that the cache manager does actually remove the old, inactive files for other sites, I fiddled with the config enough times to conclude that the proxy_cache_revalidate option is the one stopping the removal of the old inactive cache objects.

My issue is that I could not find:

  1. how often the cache manager goes trough the files to remove the old inactive objects (or clear up some space if min_free or max_size are used)
  2. any link in any documentation between proxy_cache_revalidate and the cache manager process.

The technical issue is solved, but I would appreciate a pointer to a documentation to explain this better.

Thank you!

Change History (1)

comment:1 by teodorescuserban@…, 6 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.