]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
hno squid-2.3.DEVEL3.round_robin_clear_counter.patch
authorhno <>
Wed, 3 May 2000 02:31:44 +0000 (02:31 +0000)
committerhno <>
Wed, 3 May 2000 02:31:44 +0000 (02:31 +0000)
Squid-2.3.DEVEL3: Reset "round-robin" counters every 5 minutes

Reset "round-robin" peer selection counters every 5 minutes to speed up
recovery when a dead peer has come on line again ("round-robin" is
implemented by "least-frequently-used", which without this patch gets
stronly biased to the previously dead peer).

ChangeLog
src/cache_cf.cc
src/neighbors.cc
src/protos.h
src/structs.h

index b6826e001d5db3832dbe1143d6d842452c67fefe..1006587e0c6e60ad3d4e30a3b2f9de54c7f874de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,8 @@ Changes to Squid-2.4.DEVEL3 ():
          by the origin server. Doing so could cause bandwidth spikes and/or
          negative hit ratio.
        - httpd_accel_single_host squid.conf directive
+       - "round-robin" cache_peer counters are reset every 5 minutes to
+         compensate previously dead peers
 
 Changes to Squid-2.4.DEVEL2 ():
 
index bbae7e8ad25d7a1230ed2475ff52f82cb6dfc4d3..5f7a4b9501cdd4f6c254780452b27d93cd256d82 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.339 2000/05/02 18:51:50 hno Exp $
+ * $Id: cache_cf.cc,v 1.340 2000/05/02 20:31:44 hno Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -1037,6 +1037,7 @@ parse_peer(peer ** head)
        head = &(*head)->next;
     *head = p;
     Config.npeers++;
+    peerClearRR(p);
 }
 
 static void
index 25e7a6a0ba29a2859b8fd693c08b595300f9d772..436623d3291cb1f6bf8d12db144939a4c89580cc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.281 2000/05/02 18:47:34 hno Exp $
+ * $Id: neighbors.cc,v 1.282 2000/05/02 20:31:44 hno Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -260,6 +260,18 @@ getRoundRobinParent(request_t * request)
     return q;
 }
 
+/* This gets called every 5 minutes to clear the round-robin counter. */
+void
+peerClearRR(void *data)
+{
+    peer *p = data;
+    p->rr_count -= p->rr_lastcount;
+    if (p->rr_count < 0)
+       p->rr_count = 0;
+    p->rr_lastcount = p->rr_count;
+    eventAdd("peerClearRR",peerClearRR, p, 5*60, 0);
+}
+
 peer *
 getDefaultParent(request_t * request)
 {
index c65b25907ba183d93de6f05c56b201e8a3d0af85..f5446674fca856bd57cc029456fdc9cc62936ee2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.360 2000/05/02 20:15:49 hno Exp $
+ * $Id: protos.h,v 1.361 2000/05/02 20:31:45 hno Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -633,6 +633,7 @@ extern peer *peerFindByName(const char *);
 extern peer *peerFindByNameAndPort(const char *, unsigned short);
 extern peer *getDefaultParent(request_t * request);
 extern peer *getRoundRobinParent(request_t * request);
+EVH peerClearRR;
 extern peer *getAnyParent(request_t * request);
 extern lookup_t peerDigestLookup(peer * p, request_t * request, StoreEntry * entry);
 extern peer *neighborsDigestSelect(request_t * request, StoreEntry * entry);
index 214508a3ae726a62226f6647d7578bc64d53b412..7e4d5bf54904ea1c71a19636c30b285aa5370ccb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.322 2000/05/02 20:28:30 hno Exp $
+ * $Id: structs.h,v 1.323 2000/05/02 20:31:45 hno Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -1117,6 +1117,7 @@ struct _peer {
     struct in_addr addresses[10];
     int n_addresses;
     int rr_count;
+    int rr_lastcount;
     peer *next;
     int test_fd;
 #if USE_CARP