cache manager of nginx not clearing cache as expected

Igor A. Ippolitov iippolitov at nginx.com
Wed Jan 18 19:17:31 UTC 2017


max_size is not a strict limit. It's just another watermark for cache 
manager to start deleting files.
Also, there might be a difference between du and cache manager used 
space estimation 
(https://github.com/nginx/nginx/blob/f8a9d528df92c7634088e575e5c3d63a1d4ab8ea/src/os/unix/ngx_files.h#L188)

If your cache gains 25% excess in between of cache manager invocations, 
it looks like there is too much data to cache.
You might want to split cache across several nginx instances with an 
additional nginx balancer in front of them.

You may also try upgrading nginx to the latest version where cache 
manager parameters were added 
(http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path 
,  manager_files, manager_threshold, and manager_sleep).
Using those parameters and knowing your traffic pattern you can make a 
better estimation of required cache size.
You can get newest nginx version from nginx repository: 
http://nginx.org/en/linux_packages.html

On 18.01.2017 13:44, omkar_jadhav_20 wrote:
> I can not see any open files once i fire the command on affected servers :
> lsof -n /cache | grep deleted
> Also my question is why nginx is not limiting use of cache directory to its
> max_size , like in this case I have mentioned max_size for cache directory
> as 200G but in actual particular cache directory is crossing 200G of mark
> i.e going up by 243 G.
> Could you please exaplain why this happens and what needs to be done to
> avoid such FS full scenarios which causes all requests to go upstream due to
> lack of free space in FS.
>
> Posted at Nginx Forum: https://forum.nginx.org/read.php?2,272036,272038#msg-272038
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list