Re: Re: How can I find detailed comment about Squid src?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 8 Apr 2002 11:03:15 +0200

This "age" variable is specific to the heap policy implementation.
Not used anywhere else.

In the heap policies the heap key symbols the objects "age" in the
heap. It do not have a point of origin in time, only the propertity
that the keys can be sorted.

I am not entirely sure on why the name "age" was selected for this
specific variable and is why I refer to the paper explaining the
thinking behind the heap based policy implementation. See the
description of the LFUDA implementation which was the primary policy
the heap code was written for (page 4). I think the variable should
be renamed to heap_age for clarity.

"age" in other parts of Squid usually represents the objects age in
time. For example in src/refresh.c.

Regards
Henrik

On Monday 08 April 2002 07:32, wrote:
> Thanks again, Henrik pal!
>
> Maybe my English explanation is poor, :-). I understand that
> variable "age" is referring to the top element of a
> minimum-value-heap. My question is what is the literature of the
> variable "age". IMHO, I think the "age" of an object means how long
> it has been cached in mem/disk since it is first fetched. As I have
> not read the whole source codes, so I am not very sure about it.
> Maybe my explanation is not very precise.
>
> I think you are a very warm-heated pal! And cute, :-)
>
> Have a nice day,
> George, Ma
>
> > On Sunday 07 April 2002 08:27, wrote:
> > > Hi, I am using squid 2.4 stable. When I am reading the source
> > > codes, I always run in trouble. Because I do not know the exact
> > > meaning of thre variables of structures.
> >
> > Welcome in the club ;-)
> >
> > > For example, in file store_heap_replacement.c, line 108
> > > heap_key
> > > HeapKeyGen_StoreEntry_GDSF(void *entry, double age)
> > > {
> > > StoreEntry *e = entry;
> > > heap_key key;
> > > double size = e->swap_file_sz ? (double) e->swap_file_sz :
> > > 1.0; double tie = (e->lastref > 1) ? (1.0 / e->lastref) : 1.0;
> > > key = age + ((double) e->refcount / size) - tie;
> > > debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: %s size=%f
> > > refcnt=%ld lastref=%ld age=%f tie=%f -> %f\n",
> > > storeKeyText(e->hash.key), size, e->refcount, e->lastref, age,
> > > tie, key); if (e->mem_obj && e->mem_obj->url)
> > > debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: url=%s\n",
> > > e->mem_obj->url);
> > > return key;
> > > }
> > >
> > > What is the exact meaning of "age"? Can anyone give me a brief
> > > explanation?
> >
> > In this specific case, age is the currently smallest key in the
> > heap I think. Perhaps more information is in the paper explaining
> > the heap policies. See lib/heap.c and
> > src/repl/heap/store_repl_heap.c for the source relating to this
> > specific "age".
> >
> > > Where can iI find the explanation of the variables of
> > > structures?
> >
> > Not all of Squid is explained. Actually very little of Squid is
> > explained. The currently best explanation for most things is the
> > source itself, by tracing how the variable/structure in question
> > is being used.
> >
> > Regards
> > Henrik
Received on Mon Apr 08 2002 - 03:24:42 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:58 MST