]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Jean-Gabriel Dick <jean-gabriel.dick@curie.fr>
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 12 Feb 2010 12:26:49 +0000 (01:26 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 12 Feb 2010 12:26:49 +0000 (01:26 +1300)
Bug 1843: multicast-siblings cache_peer option for optimising multicast ICP relations

'multicast-siblings' : this option is meant to be used only for cache peers of
type "multicast". It instructs Squid that ALL members of this multicast group
have "sibling" relationship with it, not "parent".  This is an optimization
that avoids useless multicast queries to a multicast group when the requested
object would be fetched only from a "parent" cache, anyway.  It's useful, e.g.,
when configuring a pool of redundant Squid proxies, being members of the same
multicast group.

doc/release-notes/release-3.1.sgml
src/cache_cf.cc
src/cf.data.pre
src/neighbors.cc
src/structs.h

index 094855ce345d2059ae4c9a8d48fb55a93462b4dc..1e0dab420bb48d487234a7c3bfc94853da3a816f 100644 (file)
@@ -955,7 +955,7 @@ NOCOMMENT_START
        <tag>cache_mem</tag>
        <p>Default size increased to 256MB.
 
-       <tag>cache_peer htcp-no-clr htcp-no-purge-clr htcp-only-clr htcp-forward-clr connection-auth[=on|off|auto] connect-fail-limit=N no-tproxy</tag>
+       <tag>cache_peer htcp-no-clr htcp-no-purge-clr htcp-only-clr htcp-forward-clr connection-auth[=on|off|auto] connect-fail-limit=N multicast-siblings no-tproxy</tag>
        <p>New Options.
        <verb>
        use 'htcp-no-clr' to send HTCP to the neighbor but without
@@ -985,6 +985,8 @@ NOCOMMENT_START
        use 'no-tproxy' to specify that requests passed to this peer
        are not to have the client IP spoofed. For use to prevent
        packet routing issues with a cluster of peers behind WCCPv2.
+
+       <p><em>multicast-siblings</em> ported from 2.7
        </verb>
 
        <tag>cache_store_log</tag>
@@ -1564,7 +1566,6 @@ This section gives an account of those changes in three categories:
        <p>COSS <em>maxfullbufs=</em> option not yet ported from 2.6
 
        <tag>cache_peer</tag>
-       <p><em>multicast-siblings</em> not yet ported from 2.7
        <p><em>idle=</em> not yet ported from 2.7
        <p><em>http11</em> not yet ported from 2.7
        <p><em>monitorinterval=</em> not yet ported from 2.6
index 0ffdb94c193d16db0d26532157f2cd43502b8dbe..5b317865242ca390bd3896c560a7434c4fb33dc2 100644 (file)
@@ -1736,6 +1736,10 @@ parse_peer(peer ** head)
             p->options.no_tproxy = 1;
         } else if (!strcasecmp(token, "multicast-responder")) {
             p->options.mcast_responder = 1;
+#if PEER_MULTICAST_SIBLINGS
+        } else if (!strcasecmp(token, "multicast-siblings")) {
+            p->options.mcast_siblings = 1;
+#endif
         } else if (!strncasecmp(token, "weight=", 7)) {
             p->weight = xatoi(token + 7);
         } else if (!strncasecmp(token, "basetime=", 9)) {
index ca234e95bfd576790cdd2dfef0613c799d4383d9..2b28fb76c703b32990a77ef0ff80dc0f7c1df94a 100644 (file)
@@ -1739,6 +1739,15 @@ DOC_START
        userhash        Load-balance parents based on the client proxy_auth or ident username.
        
        sourcehash      Load-balance parents based on the client source IP.
+
+       multicast-siblings
+                       To be used only for cache peers of type "multicast".
+                       ALL members of this multicast group have "sibling"
+                       relationship with it, not "parent".  This is to a mulicast
+                       group when the requested object would be fetched only from
+                       a "parent" cache, anyway.  It's useful, e.g., when
+                       configuring a pool of redundant Squid proxies, being
+                       members of the same multicast group.
        
        
        ==== PEER SELECTION OPTIONS ====
index 5dac62b0d92f5185c999f983e06c1b1d0abebf39..7cfb1f69f59006bfc62aa8bc76305e2196a69407 100644 (file)
@@ -124,6 +124,11 @@ neighborType(const peer * p, const HttpRequest * request)
             if (d->type != PEER_NONE)
                 return d->type;
     }
+#if PEER_MULTICAST_SIBLINGS
+    if (p->type == PEER_MULTICAST)
+        if (p->options.mcast_siblings)
+            return PEER_SIBLING;
+#endif
 
     return p->type;
 }
@@ -143,6 +148,11 @@ peerAllowedToUse(const peer * p, HttpRequest * request)
     assert(request != NULL);
 
     if (neighborType(p, request) == PEER_SIBLING) {
+#if PEER_MULTICAST_SIBLINGS
+        if (p->type == PEER_MULTICAST && p->options.mcast_siblings &&
+                (request->flags.nocache || request->flags.refresh || request->flags.loopdetect || request->flags.need_validation))
+            debugs(15, 2, "peerAllowedToUse(" << p->name << ", " << request->host << ") : multicast-siblings optimization match");
+#endif
         if (request->flags.nocache)
             return 0;
 
@@ -1570,6 +1580,11 @@ dump_peer_options(StoreEntry * sentry, peer * p)
     if (p->options.mcast_responder)
         storeAppendPrintf(sentry, " multicast-responder");
 
+#if PEER_MULTICAST_SIBLINGS
+    if (p->options.mcast_siblings)
+        storeAppendPrintf(sentry, " multicast-siblings");
+#endif
+
     if (p->weight != 1)
         storeAppendPrintf(sentry, " weight=%d", p->weight);
 
index 275bb64e227ef66e6fd76196e455daaf292becd2..45476904ead7ddf65d94a0918c15a31df9998161 100644 (file)
@@ -38,6 +38,8 @@
 /* needed for the global config */
 #include "HttpHeader.h"
 
+#define PEER_MULTICAST_SIBLINGS 1
+
 struct acl_name_list {
     char name[ACL_NAME_SZ];
     acl_name_list *next;
@@ -882,6 +884,9 @@ struct peer {
         unsigned int sourcehash:1;
         unsigned int originserver:1;
         unsigned int no_tproxy:1;
+#if PEER_MULTICAST_SIBLINGS
+        unsigned int mcast_siblings:1;
+#endif
     } options;
 
     int weight;