From: hno <> Date: Wed, 3 May 2000 00:47:33 +0000 (+0000) Subject: hno squid-2.3.DEVEL2.icp_timeout_selection.patch X-Git-Tag: SQUID_3_0_PRE1~2029 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8c926ffaabc843fcd5f4f94cf2d5a8db8d16f5b;p=thirdparty%2Fsquid.git hno squid-2.3.DEVEL2.icp_timeout_selection.patch Squid-2.3.DEVEL2: ICP timeout selection This is an attempt to fix the dynamic ICP timeout selection when one is peering with remote parents and have some close-by siblings with a much lower ICP rtt. This is done by preferring to calculate the ICP timeout based on parents only (based on siblings if there is no alive parents) --- diff --git a/ChangeLog b/ChangeLog index b0790bd704..208c68a497 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,16 @@ Changes to Squid-2.4.DEVEL3 (): - Added --enable-auth-modules=... configure option - Improved ICP dead peer detection to also work when the workload is low + - Improved TCP dead peer detection and recovery + - Squid is now a bit more persistent in trying to find a alive + parent when never_direct is used. + - nonhierarchical_direct squid.conf directive to make non-ICP + peer selection behave a bit more like ICP selection with respect + to hierarchy. + - Bugfix where netdb selection could override never_direct + - ICP timeout selection now prefers to use parents only when + calculating the dynamic timeout to compensate for common RTT + differences between parents and siblings. Changes to Squid-2.4.DEVEL2 (): diff --git a/src/neighbors.cc b/src/neighbors.cc index 306452b2ca..25e7a6a0ba 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.280 2000/05/02 18:32:41 hno Exp $ + * $Id: neighbors.cc,v 1.281 2000/05/02 18:47:34 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -374,6 +374,8 @@ neighborsUdpPing(request_t * request, 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 @@ neighborsUdpPing(request_t * request, 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 @@ neighborsUdpPing(request_t * request, (*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 */ @@ -488,15 +494,23 @@ neighborsUdpPing(request_t * request, } } #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 + if (*exprep > 0) { + if (parent_exprep) + *timeout = 2 * parent_timeout / parent_exprep; + else + *timeout = 2 * sibling_timeout / sibling_exprep; + } else *timeout = 2000; /* 2 seconds */ if (Config.Timeout.icp_query_max) if (*timeout > Config.Timeout.icp_query_max)