From: Amos Jeffries Date: Fri, 12 Feb 2010 12:26:49 +0000 (+1300) Subject: Author: Jean-Gabriel Dick X-Git-Tag: SQUID_3_1_0_17~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=721f57c2fa0a6ba6babe2eb05647cf70c60513de;p=thirdparty%2Fsquid.git Author: Jean-Gabriel Dick 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. --- diff --git a/doc/release-notes/release-3.1.sgml b/doc/release-notes/release-3.1.sgml index 094855ce34..1e0dab420b 100644 --- a/doc/release-notes/release-3.1.sgml +++ b/doc/release-notes/release-3.1.sgml @@ -955,7 +955,7 @@ NOCOMMENT_START cache_mem

Default size increased to 256MB. - 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 + 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

New Options. 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. + +

multicast-siblings ported from 2.7 cache_store_log @@ -1564,7 +1566,6 @@ This section gives an account of those changes in three categories:

COSS maxfullbufs= option not yet ported from 2.6 cache_peer -

multicast-siblings not yet ported from 2.7

idle= not yet ported from 2.7

http11 not yet ported from 2.7

monitorinterval= not yet ported from 2.6 diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 0ffdb94c19..5b31786524 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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)) { diff --git a/src/cf.data.pre b/src/cf.data.pre index ca234e95bf..2b28fb76c7 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 ==== diff --git a/src/neighbors.cc b/src/neighbors.cc index 5dac62b0d9..7cfb1f69f5 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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); diff --git a/src/structs.h b/src/structs.h index 275bb64e22..45476904ea 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;