Re: Squid 2.2.STABLE2 & choice of parent [another patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 08 May 1999 16:54:41 +0200

John Line (as web server manager) wrote:

> > Which one is the correct I don't know. Should Squid bother
> > waiting for slow siblings when the parents are much faster
> > (at least twice as fast)?
>
> I'd guess probably not...

My idea too, that is why I corrected the patch.

> 312 FIRST_PARENT_MISS/cam1.sites.wwwcache.ja.net
> 932 FIRST_PARENT_MISS/cam2.sites.wwwcache.ja.net
> 86 FIRST_UP_PARENT/cam0.sites.wwwcache.ja.net
> 14 PARENT_HIT/cam0.sites.wwwcache.ja.net
> 7 PARENT_HIT/cam1.sites.wwwcache.ja.net
> 89 PARENT_HIT/cam2.sites.wwwcache.ja.net
> 2 SIBLING_HIT/wwwcache.damtp.cam.ac.uk
> 196 TIMEOUT_FIRST_PARENT_MISS/cam1.sites.wwwcache.ja.net
> 329 TIMEOUT_FIRST_PARENT_MISS/cam2.sites.wwwcache.ja.net
> 33 TIMEOUT_FIRST_UP_PARENT/cam0.sites.wwwcache.ja.net

Looks good.

> The counts above also reinforce my feeling that RTT estimates should
> influence routing even for requests that get ICP timeouts from all peers
> (assuming that's not because all peers are down... :-) - the FIRST_UP_PARENT
> choice was cam0.sites but that parent is clearly being avoided by the
> ICP-based routing and it seems to have problems at present - continual
> stream of TCP connection failed (with occasional succeeded), etc. Being
> first in the list does not mean it's a good (or even reasonable) choice.

Attached is a patch designed to select the parent with lowest
statistical RTT when ICP times out.

> A few other miscellaneous points that arose in this morning's testing:
>
> (1) The first couple of times I attempted to start the recompiled Squid 2.2
> with the patch, startup failed with an "Arithmetic Exception" message
> appearing in the middle of the startup script's output.

That is usually divide by zero.. is it a fatal error on your platform,
or did Squid continue?

The easiest way to find those startup errors is to start the program
from inside a debugger (preferably gdb).
gdb squid
gdb> r -CNd1

> (2) I've mentioned before that adding an extra debug option sometimes seem
> to cause all cache.log output to cease, and it was happening again, though

I think the squid.conf syntax requires you to write all debug options on
a single line. Later lines override the previous completely.

> My guess (without checking the source code) is that something's not allowing
> enough time for a clean shutdown.

Hmm.. your list included swap.state, and swap.state is always closed on
shutdown. The same is true for the other log files.

    [ Part 2: "Attached Text" ]

Index: squid/src/neighbors.c
diff -u squid/src/neighbors.c:1.1.1.31.6.4 squid/src/neighbors.c:1.1.1.31.6.6
--- squid/src/neighbors.c:1.1.1.31.6.4 Sat May 8 14:28:45 1999
+++ squid/src/neighbors.c Sat May 8 16:49:44 1999
@@ -239,6 +239,32 @@
 }
 
 peer *
+getLowestRttParent(request_t * request)
+{
+ peer *p;
+ peer *p_rtt = NULL;
+ for (p = Config.peers; p; p = p->next) {
+ if (!neighborUp(p))
+ continue;
+ if (neighborType(p, request) != PEER_PARENT)
+ continue;
+ if (!peerHTTPOkay(p, request))
+ continue;
+ if (!peerWouldBePinged(p, request))
+ continue;
+ if (!p_rtt || p->stats.rtt < p_rtt->stats.rtt)
+ p_rtt = p;
+ }
+ if (p_rtt)
+ debug(15, 3) ("getLowestRttParent: returning %s RTT %d msec\n", p_rtt->host, p_rtt->stats.rtt);
+ else
+ debug(15, 4) ("getLowestRttParent: none found\n");
+ return p_rtt;
+}
+
+
+
+peer *
 getRoundRobinParent(request_t * request)
 {
     peer *p;
Index: squid/src/peer_select.c
diff -u squid/src/peer_select.c:1.1.1.27.2.5 squid/src/peer_select.c:1.1.1.27.2.6
--- squid/src/peer_select.c:1.1.1.27.2.5 Fri May 7 16:19:25 1999
+++ squid/src/peer_select.c Sat May 8 16:23:22 1999
@@ -392,6 +392,10 @@
     if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr) {
         p = whichPeer(&ps->closest_parent_miss);
         code = CLOSEST_PARENT_MISS;
+ } else if (ps->ping.timedout) {
+ /* ICP pinging timedout, use estimated rtt's for selecing parent */
+ p = getLowestRttParent(request);
+ code = FIRST_PARENT_MISS;
     } else if (ps->first_parent_miss.sin_addr.s_addr != any_addr.s_addr) {
         p = whichPeer(&ps->first_parent_miss);
         code = FIRST_PARENT_MISS;
Index: squid/src/protos.h
diff -u squid/src/protos.h:1.1.1.39.4.2 squid/src/protos.h:1.1.1.39.4.3
--- squid/src/protos.h:1.1.1.39.4.2 Wed May 5 11:33:51 1999
+++ squid/src/protos.h Sat May 8 16:23:22 1999
@@ -587,6 +587,7 @@
 
 extern peer *getFirstPeer(void);
 extern peer *getFirstUpParent(request_t *);
+extern peer *getLowestRttParent(request_t *);
 extern peer *getNextPeer(peer *);
 extern peer *getSingleParent(request_t *);
 extern int neighborsCount(request_t *);
Received on Tue Jul 29 2003 - 13:15:58 MDT

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