[squid-users] Re: ordering in rebuilt swap.state

From: RW <rwmaillists_at_googlemail.com>
Date: Thu, 26 Jan 2012 02:27:31 +0000

On Thu, 26 Jan 2012 12:19:30 +1300
Amos Jeffries wrote:

> On 26.01.2012 12:02, RW wrote:
> > I noticed today that according to "squidclient mgr:storedir" my
> > retention had dropped from 200+ days to 5 days, but all the content
> > still seemed to be there. I tried rebuilding swap.state from the
> > cache
> > files, but it made no difference.
>
> Under the LRU retention policy the cache age is just a measure of the
> oldest file creation timestamp.

mtime surely.

My assumption was that the linked list in memory was not correctly
ordered, and so the head object wasn't the least recently used.

> I suspect you had one file up at 200 days and most of the cache under
> 5 days. That file recently being erased the retention details drop
> immediately to a different oldest entry (added 5 days ago).

It isn't, it's 200 days of steady use, and the cache is less than half
full, so nothing has been erased. And as I said squid had picked-up all
the 200 days worth of content (8GB and 300,000 objects).

Actually I did lower the cache size to delete a few hundred MB, and I
watched the "cache age" in real-time and it all over the place.

> >
> > I'm guessing that the rebuild had already been done automatically
> > and that when that happens there's no explicit sort to restore lru
> > order, it just relies on subsequent access and ageing. Does that
> > sound reasonable?
> >
> > I was wondering, if I wrote bit of script to rename the cache files
> > into mtime order could I rebuild swap.state in lru order?
>
> You could, but it would be of little value. The cache file names and
> swap.state order has no bearing on the memory index hash algorithm,
> retention policy algorithm,

I assumed that part of the point of having a journal was that reading
it in sequentially would lru order the queue when squid starts up.
Does squid not preserve that information across restarts?

> FYI: swap.state is simply a journal of what has been added/removed
> from that cache. A "rebuild' is just a dump of the memory index
> contents into a fresh empty journal file. Effectively erasing all
> records of things removed.
 
I was referring to deleting swap.state when squid isn't running, in
which case it's recreated from the cache files.
Received on Thu Jan 26 2012 - 02:27:56 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 26 2012 - 12:00:03 MST