cache worker stops evicting assets

Maxim Dounin mdounin at
Thu Dec 15 13:48:42 UTC 2016


On Thu, Dec 15, 2016 at 04:38:18AM -0500, miracle.max wrote:

> Hello there! we currently have this issue when we restart nginx, the cache
> zone disk consume rise constantly until we reach the 84h after the restart,
> here nginx locks and start deleting, after 15-30m everything starts working
> as usual and the cache worker behaves as expected until we do another
> restart.
> Our current configuration is
> proxy_cache_path /var/cache/nginx/assets levels=2:2 keys_zone=assets:512m
>                  inactive=84h max_size=81920m use_temp_path=off
>                  loader_files=1000 loader_sleep=50ms
> loader_threshold=300ms;
> We currently have ˜2 million object consuming ˜40G.
> Could be that cache loader worker cant keep up with all those objects after
> the restart?

Inactive times are only recorded in memory and therefore are lost 
on restart.  As a result nothing will be deleted from cache based 
on inactive time for 84 hours after a restart (note "inactive=84h" 
in your configuration).  Cache manager will still monitor cache 
size and remove oldest items based on max_size configured, but 
it doesn't look like you reach it.

After 84 hours cache manager will start removing items that were 
not accessed since restart.  If this implies significant load in 
your setup, consider looking at manager_files, manager_sleep, and 
manager_threshold parameters of the proxy_cache_path directive as 
introduced in nginx 1.11.5.

Maxim Dounin

More information about the nginx mailing list