--------------------- PatchSet 11542 Date: 2007/07/20 21:08:47 Author: hno Branch: HEAD Tag: (none) Log: 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. Members: src/cache_cf.c:1.469->1.470 src/cf.data.pre:1.404->1.405 src/neighbors.c:1.317->1.318 src/structs.h:1.519->1.520 Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid/squid/src/cache_cf.c,v retrieving revision 1.469 retrieving revision 1.470 diff -u -r1.469 -r1.470 --- squid/src/cache_cf.c 16 Apr 2007 22:05:04 -0000 1.469 +++ squid/src/cache_cf.c 20 Jul 2007 21:08:47 -0000 1.470 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.469 2007/04/16 22:05:04 hno Exp $ + * $Id: cache_cf.c,v 1.470 2007/07/20 21:08:47 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1646,6 +1646,10 @@ p->options.no_digest = 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 (!strcasecmp(token, "closest-only")) { Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid/squid/src/cf.data.pre,v retrieving revision 1.404 retrieving revision 1.405 diff -u -r1.404 -r1.405 --- squid/src/cf.data.pre 9 Jul 2007 19:23:27 -0000 1.404 +++ squid/src/cf.data.pre 20 Jul 2007 21:08:47 -0000 1.405 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.404 2007/07/09 19:23:27 wessels Exp $ +# $Id: cf.data.pre,v 1.405 2007/07/20 21:08:47 hno Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -459,6 +459,7 @@ default round-robin multicast-responder + multicast-siblings closest-only no-digest no-netdb-exchange @@ -521,6 +522,17 @@ not be sent directly to the peer, but ICP replies will be accepted from it. + the 'multicast-siblings' 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. + 'closest-only' indicates that, for ICP_OP_MISS replies, we'll only forward CLOSEST_PARENT_MISSes and never FIRST_PARENT_MISSes. Index: squid/src/neighbors.c =================================================================== RCS file: /cvsroot/squid/squid/src/neighbors.c,v retrieving revision 1.317 retrieving revision 1.318 diff -u -r1.317 -r1.318 --- squid/src/neighbors.c 19 Mar 2007 01:21:18 -0000 1.317 +++ squid/src/neighbors.c 20 Jul 2007 21:08:47 -0000 1.318 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.317 2007/03/19 01:21:18 swilton Exp $ + * $Id: neighbors.c,v 1.318 2007/07/20 21:08:47 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -104,6 +104,11 @@ 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; } @@ -120,6 +125,12 @@ int do_ping = 1; 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)) + debug(15, 2) ("peerAllowedToUse(%s, %s) : multicast-siblings optimization match\n", + p->name, request->host); +#endif if (request->flags.nocache) return 0; if (request->flags.refresh) @@ -1252,6 +1263,10 @@ storeAppendPrintf(sentry, " round-robin"); 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); if (p->options.closest_only) Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid/squid/src/structs.h,v retrieving revision 1.519 retrieving revision 1.520 diff -u -r1.519 -r1.520 --- squid/src/structs.h 15 Jul 2007 05:41:20 -0000 1.519 +++ squid/src/structs.h 20 Jul 2007 21:08:47 -0000 1.520 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.519 2007/07/15 05:41:20 hno Exp $ + * $Id: structs.h,v 1.520 2007/07/20 21:08:47 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -37,6 +37,8 @@ #include "config.h" #include "splay.h" +#define PEER_MULTICAST_SIBLINGS 1 + struct _dlink_node { void *data; dlink_node *prev; @@ -1426,6 +1428,9 @@ unsigned int default_parent:1; unsigned int roundrobin:1; unsigned int mcast_responder:1; +#if PEER_MULTICAST_SIBLINGS + unsigned int mcast_siblings:1; +#endif unsigned int closest_only:1; #if USE_HTCP unsigned int htcp:1;