Nginx does not delete old cached files

atrus nginx-forum at nginx.us
Mon Apr 27 08:53:21 UTC 2015


Hi,

I have nginx serve as image cached, here is the main config :

proxy_cache_path /etc/nginx/cache-media levels=1:2 keys_zone=media:1000m
inactive=2y max_size=100g;
proxy_temp_path /etc/nginx/cache-media/tmp;

/dev/sdc1 is an intel SSD with ext4 mounted (-o noatime, nodiratime).

It looks like that the nginx do not evict the old cached files :

Disk usage on /dev/sdc1 :

# df -h /dev/sdc1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1       110G  102G  7.5G  94% /etc/nginx/cache-media

the max_size=100g but the real size has been raise up to 102GB.

Sometime it full up to 100% of the sdc1 disk and get errror : 2015/04/27
12:03:55 [crit] 7708#0: *18862126 pwrite()
"/etc/nginx/cache-media/tmp/0004826203" failed (28: No space left on device)
while reading upstream,

and I need to manually remove by find && rm -rf

My nginx -V :

ginx version: nginx/1.7.10
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
--with-http_ssl_module --with-http_realip_module --with-http_addition_module
--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_random_index_module
--with-http_secure_link_module --with-http_stub_status_module
--with-http_auth_request_module --with-mail --with-mail_ssl_module
--with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g
-pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic'

Plz tell me what could be the problem ?

Thank you.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,258396,258396#msg-258396



More information about the nginx mailing list