]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Jean-Gabriel Dick <jean-gabriel.dick@curie.fr>
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 5 Feb 2010 23:27:27 +0000 (12:27 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 5 Feb 2010 23:27:27 +0000 (12:27 +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
doc/release-notes/release-3.2.sgml
src/cache_cf.cc
src/cf.data.pre
src/neighbors.cc
src/structs.h

index 020ed27dcfc4fca8bc98a8eb97b20af075c121f0..7e81337def829281544c9a22519059bf142735cf 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>
@@ -1552,7 +1554,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 443c20334205f135a5a44c2b33096b3d7ae708f2..666fcee0e7ba0517e26f4ac5d9e7714f68678006 100644 (file)
@@ -429,7 +429,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 4a555db714b02e8f79aae797ca01ddcd2d14823e..c8e2057e2e50e2dc77155d27423a66877d06ab39 100644 (file)
@@ -1740,6 +1740,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 (!strncasecmp(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 d17745c08b94aaf6d48809bab7151f2bd30d9518..0b44064635218bec19ba337cc81ed0233b0e13b7 100644 (file)
@@ -1793,6 +1793,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 1868b00d9c3818e4f56e14b6cdb27637da930a5e..57aecd1c0ed47fd685c5abf0895cb165e53f7ef2 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;
 
@@ -1564,6 +1574,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 703f40ebb8acf00c72edcc8e6ff859e5feb4c9a8..416799b45dbcdbb9f8307b700a40c5e1951eaf50 100644 (file)
@@ -41,6 +41,8 @@
 /* for ICP_END */
 #include "icp_opcode.h"
 
+#define PEER_MULTICAST_SIBLINGS 1
+
 struct acl_name_list {
     char name[ACL_NAME_SZ];
     acl_name_list *next;
@@ -889,6 +891,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;