--MimeMultipartBoundary
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Here are some patches I've made for squid 1.1.20. They change the
behaviour of local_ip and local_domain to not only fetch the items
directly, but to not cache them.
The reasoning for this is that if it's local, then it's arbitrarily
easy to fetch directly. If it's arbitrarily easy to fetch directly,
then there is relatively no penalty for not-caching it. This leaves
more room to cache objects beyond our borders.
While it's probably faster to serve the local objects out of squid,
it should be much faster to serve additionaly "outside" objects. Ie.
the potential speed increase for the additional outside objects
outweigh the potential speed decrease from lessened local objects.
I have placed defines around the sections of code I have modified, where
appropriate such that people can choose the behaviour they wish for,
and hence to promote it's inclusion in the main-stream code.
The patches follow:
*** /shared/src/built/DU4.0/squid-1.1.20/src/Makefile Mon Jan 12 18:17:52 1998
--- squid-1.1.20/src/Makefile Fri Feb 27 00:59:29 1998
***************
*** 19,30 ****
USE_BIN_TREE = # -DUSE_BIN_TREE
RELOAD_INTO_IMS = # -DRELOAD_INTO_IMS
UNDERSCORES_OPT = # -DALLOW_HOSTNAME_UNDERSCORES
DEFINES = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
$(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
$(KILL_PARENT_OPT) $(USE_POLL_OPT) \
$(USE_SPLAY_TREE) $(USE_BIN_TREE) \
! $(RELOAD_INTO_IMS) $(UNDERSCORES_OPT)
prefix = /usr/local/squid
exec_prefix = ${prefix}
--- 19,32 ----
USE_BIN_TREE = # -DUSE_BIN_TREE
RELOAD_INTO_IMS = # -DRELOAD_INTO_IMS
UNDERSCORES_OPT = # -DALLOW_HOSTNAME_UNDERSCORES
+ NO_CACHE_LOCAL = -DNO_CACHE_LOCAL
DEFINES = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
$(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
$(KILL_PARENT_OPT) $(USE_POLL_OPT) \
$(USE_SPLAY_TREE) $(USE_BIN_TREE) \
! $(RELOAD_INTO_IMS) $(UNDERSCORES_OPT) \
! $(NO_CACHE_LOCAL)
prefix = /usr/local/squid
exec_prefix = ${prefix}
*** /shared/src/built/DU4.0/squid-1.1.20/src/icp.c Wed Dec 17 23:58:54 1997
--- squid-1.1.20/src/icp.c Thu Feb 26 23:49:48 1998
***************
*** 421,426 ****
--- 421,430 ----
request_t *req = icpState->request;
method_t method = req->method;
const wordlist *p;
+ #if defined(NO_CACHE_LOCAL)
+ ipcache_addrs * ia;
+ struct in_addr srv_addr;
+ #endif
if (BIT_TEST(icpState->request->flags, REQ_AUTH))
return 0;
***************
*** 431,436 ****
--- 435,456 ----
if (Config.cache_stop_relist)
if (aclMatchRegex(Config.cache_stop_relist, request))
return 0;
+ #if defined(NO_CACHE_LOCAL)
+ if (Config.local_ip_list) {
+ ia=ipcache_gethostbyname(req->host,0);
+ if (ia != NULL) {
+ srv_addr = ia->in_addrs[ia->cur];
+ if (ip_access_check(srv_addr,Config.local_ip_list) == IP_DENY)
+ return 0;
+ }
+ }
+ if (Config.local_domain_list) {
+ for (p = Config.local_domain_list; p; p = p->next) {
+ if (matchDomainName(p->key, req->host))
+ return 0;
+ }
+ }
+ #endif
if (req->protocol == PROTO_HTTP)
return httpCachable(request, method);
/* FTP is always cachable */
*** /shared/src/built/DU4.0/squid-1.1.20/src/neighbors.c Fri Oct 31 20:34:19 1997
--- squid-1.1.20/src/neighbors.c Fri Feb 27 00:22:23 1998
***************
*** 155,160 ****
--- 155,163 ----
"CLOSEST_PARENT_MISS",
"CLOSEST_DIRECT",
"LOCAL_IP_DIRECT",
+ #if defined(NO_CACHE_LOCAL)
+ "LOCAL_DOMAIN_DIRECT",
+ #endif
"FIREWALL_IP_DIRECT",
"NO_DIRECT_FAIL",
"SOURCE_FASTEST",
*** /shared/src/built/DU4.0/squid-1.1.20/src/neighbors.h Fri Oct 31 10:41:28 1997
--- squid-1.1.20/src/neighbors.h Fri Feb 27 00:17:33 1998
***************
*** 123,128 ****
--- 123,131 ----
HIER_CLOSEST_PARENT_MISS,
HIER_CLOSEST_DIRECT,
HIER_LOCAL_IP_DIRECT,
+ #if defined(NO_CACHE_LOCAL)
+ HIER_LOCAL_DOMAIN_DIRECT,
+ #endif
HIER_FIREWALL_IP_DIRECT,
HIER_NO_DIRECT_FAIL,
HIER_SOURCE_FASTEST,
*** /shared/src/built/DU4.0/squid-1.1.20/src/proto.c Tue Dec 9 17:24:57 1997
--- squid-1.1.20/src/proto.c Fri Feb 27 01:35:06 1998
***************
*** 193,199 ****
return;
}
if (protoData->direct_fetch == DIRECT_MAYBE
! && (Config.local_ip_list || Config.firewall_ip_list)) {
if (ia == NULL) {
debug(17, 3, "Unknown host: %s\n", req->host);
protoData->direct_fetch = DIRECT_NO;
--- 193,203 ----
return;
}
if (protoData->direct_fetch == DIRECT_MAYBE
! && (Config.local_ip_list || Config.firewall_ip_list
! #ifdef NO_CACHE_LOCAL
! || Config.local_domain_list
! #endif
! )) {
if (ia == NULL) {
debug(17, 3, "Unknown host: %s\n", req->host);
protoData->direct_fetch = DIRECT_NO;
***************
*** 215,221 ****
protoData->direct_fetch = DIRECT_NO;
#endif
}
! } else if (Config.local_ip_list) {
srv_addr = ia->in_addrs[ia->cur];
if (ip_access_check(srv_addr, Config.local_ip_list) == IP_DENY) {
hierarchyNote(req, HIER_LOCAL_IP_DIRECT, 0, req->host);
--- 219,225 ----
protoData->direct_fetch = DIRECT_NO;
#endif
}
! } else { if (Config.local_ip_list) {
srv_addr = ia->in_addrs[ia->cur];
if (ip_access_check(srv_addr, Config.local_ip_list) == IP_DENY) {
hierarchyNote(req, HIER_LOCAL_IP_DIRECT, 0, req->host);
***************
*** 222,228 ****
protoStart(protoData->fd, entry, NULL, req);
return;
}
! }
}
if ((e = protoData->single_parent) && Config.singleParentBypass) {
/* Don't execute this block simply because direct == NO, we
--- 226,240 ----
protoStart(protoData->fd, entry, NULL, req);
return;
}
! #ifdef NO_CACHE_LOCAL
! } if (Config.local_domain_list) {
! if (matchLocalDomain(req->host)) {
! hierarchyNote(req, HIER_LOCAL_DOMAIN_DIRECT, 0, req->host);
! protoStart(protoData->fd, entry, NULL, req);
! return;
! }
! #endif
! }}
}
if ((e = protoData->single_parent) && Config.singleParentBypass) {
/* Don't execute this block simply because direct == NO, we
***************
*** 403,409 ****
protoDispatchDNSHandle(fd,
NULL,
(void *) protoData);
! } else if (matchLocalDomain(request->host) || !protoData->hierarchical) {
/* will fetch from source */
protoData->direct_fetch = DIRECT_YES;
protoData->ip_lookup_pending = 1;
--- 415,425 ----
protoDispatchDNSHandle(fd,
NULL,
(void *) protoData);
! } else if (
! #ifndef NO_CACHE_LOCAL
! matchLocalDomain(request->host) ||
! #endif
! !protoData->hierarchical) {
/* will fetch from source */
protoData->direct_fetch = DIRECT_YES;
protoData->ip_lookup_pending = 1;
***************
*** 419,425 ****
fd,
protoDispatchDNSHandle,
(void *) protoData);
! } else if (Config.local_ip_list) {
/* Have to look up the url address so we can compare it */
protoData->source_ping = Config.sourcePing;
protoData->direct_fetch = DIRECT_MAYBE;
--- 435,445 ----
fd,
protoDispatchDNSHandle,
(void *) protoData);
! } else if (Config.local_ip_list
! #ifdef NO_CACHE_LOCAL
! || Config.local_domain_list
! #endif
! ) {
/* Have to look up the url address so we can compare it */
protoData->source_ping = Config.sourcePing;
protoData->direct_fetch = DIRECT_MAYBE;
-- Stephen A. Griffin UltraNet Communications Development Group Network Operations Center u-steve@ultra.net noc@ultra.net --MimeMultipartBoundary--Received on Tue Jul 29 2003 - 13:15:47 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:43 MST