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

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 08 May 1999 14:36:58 +0200

There is a small design error in my patch, making it perform slightly
different than I described.

        if (parent_timeout > sibling_timeout)

should read

        if (parent_exprep)

Updated patch attached.

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)?

/Henrik

    [ Part 2: "Attached Text" ]

Index: squid/src/neighbors.c
diff -u squid/src/neighbors.c:1.1.1.31.6.2 squid/src/neighbors.c:1.1.1.31.6.4
--- squid/src/neighbors.c:1.1.1.31.6.2 Wed May 5 11:33:50 1999
+++ squid/src/neighbors.c Sat May 8 14:28:45 1999
@@ -374,6 +374,8 @@
     icp_common_t *query;
     int queries_sent = 0;
     int peers_pinged = 0;
+ int parent_timeout = 0, parent_exprep = 0;
+ int sibling_timeout = 0, sibling_exprep = 0;
 
     if (Config.peers == NULL)
         return 0;
@@ -383,7 +385,6 @@
     mem->start_ping = current_time;
     mem->ping_reply_callback = callback;
     mem->ircb_data = callback_data;
- *timeout = 0.0;
     reqnum = icpSetCacheKey(entry->key);
     for (i = 0, p = first_ping; i++ < Config.npeers; p = p->next) {
         if (p == NULL)
@@ -438,8 +439,13 @@
             (*exprep) += p->mcast.n_replies_expected;
         } else if (neighborUp(p)) {
             /* its alive, expect a reply from it */
- (*exprep)++;
- (*timeout) += p->stats.rtt;
+ if (neighborType(p, request) == PEER_PARENT) {
+ parent_exprep++;
+ parent_timeout += p->stats.rtt;
+ } else {
+ sibling_exprep++;
+ sibling_timeout += p->stats.rtt;
+ }
         } else {
             /* Neighbor is dead; ping it anyway, but don't expect a reply */
             /* log it once at the threshold */
@@ -489,12 +495,20 @@
     }
 #endif
     /*
+ * How many replies to expect?
+ */
+ *exprep = parent_exprep + sibling_exprep;
+ /*
      * If there is a configured timeout, use it
      */
     if (Config.Timeout.icp_query)
         *timeout = Config.Timeout.icp_query;
     else if (*exprep > 0)
- (*timeout) = 2 * (*timeout) / (*exprep);
+ /* Else use a calculated timeout */
+ if (parent_exprep)
+ *timeout = 2 * parent_timeout / parent_exprep;
+ else
+ *timeout = 2 * sibling_timeout / sibling_exprep;
     else
         *timeout = 2000; /* 2 seconds */
     return peers_pinged;
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