Re: alternate parent selection algorithms

From: Niilo Neuvo <niilo.neuvo@dont-contact.us>
Date: Wed, 28 Oct 1998 22:15:19 +0200

Alex Rousskov writes:
>On Wed, 28 Oct 1998, Niilo Neuvo wrote:
>
>> The other point is that I want to move the process of selecting the
>> cache that actually contains (or should contain) the object to the
>> client software.
>>
>> I have a small javascript code that does this by calculating a hash
>> code from every url and decides what parent to use. It is vital that
>> the javascript uses the same algorithm as the parent cache uses.
>
>Hmm.. Change your custom Javascript hash function to mimic CARP hashing
>algorithm and use CARP on parent? CARP support in Squid is experimental, but
>I think people reported that it works. Just a thought...

The capabilities of javascript are very limited, especially on the
older browsers. For example I can't convert characters to integers,
which is vital to most hashing algorithms (like the one CARP uses).
Nor can I perform floating point math and even dream that the machines
will get same results (this is a very small problem).

Otherwise CARP seems to almost do what I want. I'll just write my own
version of carp.c.

Having similar hooks as Apache to various parts of the engine would be
nice. Even if it were implemented with dlopen() as I was planning to
do.

After reading through carp.c I encountered the following unrelated
problems:
    /*
     * sum of carp-load-factor's for all cache_peer's in squid.conf
     * must equal 1.0
     */
    assert(a == 1.0);
This floating point math will never work out if I have three caches
that should be equally balanced. In my opinion math like this should
be written with integers.

Line 93 in carp.c calls ulrCanonical, which returns a malloced string.
This is never freed. I haven't noticed anything about a garbage
collector, so this probably is a bug.

-- 
     Niilo Neuvo                   >>>^<<<       niilo.neuvo@saunalahti.fi
     Technical Director              /¤\      +358 (0) 50 5611042 (mobile)
     SAUNALAHDEN SERVERI OY          | |         +358 (0) 3 31558042 (fax)
     .¸¸.·´´¯·.¸¸.·´´¯·.¸¸.·´´¯·.¸¸.oOOOo.¸¸.·´´¯·.¸¸.·´´¯·.¸¸.·´´¯·.¸¸.·´
Received on Tue Jul 29 2003 - 13:15:54 MDT

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