W3C home > Mailing lists > Public > www-lib@w3.org > January to March 1999

Re: DNS weight logic wrong

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Wed, 03 Feb 1999 12:37:57 -0500
Message-Id: <3.0.5.32.19990203123757.03283430@localhost>
To: Klaus Weide <kweide@tezcat.com>, www-lib@w3.org
At 10:44 2/3/99 -0600, Klaus Weide wrote:
>Trying to understand the logic of the DNS cache, I found several things 
>that look wrong.

Yes, at some point in time, the resolution was changed from secs to millies
and you are right that it didn't happen as smooth as one might have hoped.

>  First, the comparison logic in HTGetHostByName makes
>it obvious that "small number" is "good".  (The comment
>
>            double best_weight = 1e30;                        /* Pretty
good */
>
>is misleading.)

Changed to "bad"

>  But HTDoConnect passes a negative value to 
>HTDNS_updateWeigths as deltatime after a successful connect.
>Fix: replace the two occurrences in HTTCP.c of
>
>      me->connecttime -= HTGetTimeInMillis();
>
>with
>
>      me->connecttime = HTGetTimeInMillis() - me->connecttime;

That's right too - fixed.

>Second, the values in HTTCP.c's #defines for TCP_PENALTY and TCP_DELAY
>seem to be meant as seconds, but are added to me->connecttime
>directly - there's a facor of 1000 missing somewhere.

It's the #defines that are wrong - also fixed. New values are 30000 and 60000

>Questions: HTDoConnect has
>
>                    if (HT_HOSTUNREACHABLE(socerrno))
>                        me->connecttime += TCP_DELAY;
>                    else
>                        me->connecttime += TCP_PENALTY;
>
>Shouldn't that be the other way?
>What are the other errors, anticipated to not be covered by
>HT_HOSTUNREACHABLE? The comment for TCP_DELAY says:
>
>/* x seconds penalty on a multi-homed host if IP-address is timed out */
>
>Is the code using TCP_DELAY actually reached if a conect timeout occurs?

Not anymore - the HT_HOSTUNREACHABLE has been redefined at some point. Now
it is set to be the delay if some unknown error occurred during connect.

>Nit: the spelling of "Weight" in HTDNS_updateWeigths (and some trace
>messages in that function) is wrong.  I only noticed when searching
>for "weight" didn't find anything. :)

:( I had problems spelling preemptive to - but at least it wasn't me who
came up with HTTP's referer. I have fixed the comments but not changed the
name of the function.

When running the event loop sample, it seems to give better numbers now:

	http://www.w3.org/Library/Examples/#event

I have committed these patches, see

	http://db.w3.org/Library/latest.sql

as usual.

Thanks

Henrik
--
Henrik Frystyk Nielsen,
World Wide Web Consortium
http://www.w3.org/People/Frystyk
Received on Wednesday, 3 February 1999 12:38:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:28 GMT