# Proxy\_cache purge details

**URL:** <https://www.ruby-forum.com/t/proxy-cache-purge-details/238549>\
**Category:** NGINX\
**Created:** [January 16, 2014, 1:34pm UTC](https://www.ruby-forum.com/t/proxy-cache-purge-details/238549 "2014-01-16T13:34:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [January 16, 2014, 1:34pm UTC](https://www.ruby-forum.com/t/proxy-cache-purge-details/238549/1 "2014-01-16T13:34:00Z")

</div>

Hello,

we’ve got a problem with the proxy\_cache feature in nginx. To be more  
precise, the problem occurs when the cache loader kicks in and starts  
deleting the expired files that are stored on a LVM-striped (non-raid)  
ext4 partition across six huge SSD disks. The purge (sometimes?) takes  
ages and it completely kills the reads from the partition.

That’s hardly an nginx issue, but it is why we would like to know if  
there’s a posibility to force the cache purge so that small amounts of  
files get deleted more often rather than a lot of files at once getting  
deleted less often.

Also, it would help us to know just exactly how (and where) does the  
nginx store the last-access-time information for each file (for the  
‘inactive’ feature in proxy\_cache\_path directive), if the atime feature  
is off for performance reasons. I’m guessing that it needs to store this  
so that it knows when to delete the files. It’s quite difficult for us  
to find it in the sources, so if you could point us in the right  
direction, it would be awesome!

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![David\_Watzke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c37758/32.png) [@David\_Watzke](https://www.ruby-forum.com/u/David_Watzke)\
**Post date:** [January 16, 2014, 6:03pm UTC](https://www.ruby-forum.com/t/proxy-cache-purge-details/238549/2 "2014-01-16T18:03:01Z")

</div>

Hello!

On Thu, Jan 16, 2014 at 01:33:17PM +0100, David Watzke wrote:

> deleted more often rather than a lot of files at once getting deleted less  
> often.
> 
> Also, it would help us to know just exactly how (and where) does the nginx  
> store the last-access-time information for each file (for the ‘inactive’  
> feature in proxy\_cache\_path directive), if the atime feature is off for  
> performance reasons. I’m guessing that it needs to store this so that it  
> knows when to delete the files. It’s quite difficult for us to find it in  
> the sources, so if you could point us in the right direction, it would be  
> awesome!

Last access information, as used to track cache items inactivity,  
is stored in cache memory zone only. Or, more precisely, derived  
“expire” value is stored in nodes. If cache is reloaded from  
disk, last access is assumed to be at the time of loading cache  
item by the loader.

It is strange that removing inactive cache items causes problems  
(there shouldn’t be many at any given moment, event after reload,  
because loading is limited by loader\_files, loader\_sleep,  
loader\_threshold parameters of the proxy\_cache\_path directive).  
But if it is, it’s mostly the ngx\_http\_file\_cache\_expire()  
function you should look into.

–  
Maxim D.  
[http://nginx.org/](http://nginx.org/)
