Re: Why would you use generic_cbdata ?

From: Duane Wessels <wessels@dont-contact.us>
Date: Sun, 8 Oct 2000 22:02:59 -0600 (MDT)

On Mon, 9 Oct 2000, Adrian Chadd wrote:

>
> I'm peering through some of the calloc/malloc's and I came across
> the generic_cbdata struct. Is there a reason why you WOULDN"T want
> to stick something in the cbdata list?

Yes, there is a reason.

The way things work, you add must add all pointers of the same "type"
to the cbdata. So, for example, every ConnectStateData that gets
created is added, every clientHttpRequest is added, etc.

There is some overhead to searching the cbdata hash, so we want to keep it
as small as possible.

The data structures that are added to cbdata tend to be per-request structures.
That is, you have just one clientHttpRequest, and just one ConnectStateData
structure allocated for each active request.

You'll notice that really popular structures like StoreEntry and MemObject
are not added to cbdata. This would make the hash table too big, and consume
too much extra memory.

The ipcache/fqdncache structures are less popular than StoreEntry, but still
might be in the 10,000 range. They aren't added either.

But there are some times when we really want to use ipcache_entry
or MemObject in the cbdata registry. The best way that I found to
do that was with the generic_cbdata structure. You lose a little
with the extra dereference, but it allows popular structures to be
added as needed, without having to add each and every one of them.
 
> I can only find references in fqdncache.c, ipcache.c and store_swapout.c .
> Is there any reason why it shouldn't be removed ?

I do not want it removed.

Duane W.
Received on Sun Oct 08 2000 - 22:02:59 MDT

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