From: wessels <> Date: Thu, 10 Sep 1998 02:05:47 +0000 (+0000) Subject: changed no-caching based on http service time to be based on number X-Git-Tag: SQUID_3_0_PRE1~2752 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5f627c2b18bfc4d2fc1f6627939947df82bcbe2;p=thirdparty%2Fsquid.git changed no-caching based on http service time to be based on number of disk files open. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index c2a059469a..dc2c1c3169 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.106 1998/09/09 18:21:50 wessels Exp $ +# $Id: cf.data.pre,v 1.107 1998/09/09 20:05:47 wessels Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -2579,4 +2579,10 @@ min_icp_poll_cnt 8 min_http_poll_cnt 8 DOC_END +NAME: max_open_disk_fds +TYPE: int +LOC: Config.max_open_disk_fds +DEFAULT: 0 +DOC_NONE + EOF diff --git a/src/fd.cc b/src/fd.cc index 68c5daf7e6..a1088d2ad4 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -1,6 +1,6 @@ /* - * $Id: fd.cc,v 1.26 1998/07/22 20:37:18 wessels Exp $ + * $Id: fd.cc,v 1.27 1998/09/09 20:05:49 wessels Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -77,6 +77,8 @@ fd_close(int fd) debug(51, 3) ("fd_close FD %d %s\n", fd, F->desc); fdUpdateBiggest(fd, F->open = FD_CLOSE); Number_FD--; + if (F->type == FD_FILE) + open_disk_fd--; memset(F, '\0', sizeof(fde)); F->timeout = 0; } @@ -97,6 +99,8 @@ fd_open(int fd, unsigned int type, const char *desc) if (desc) xstrncpy(F->desc, desc, FD_DESC_SZ); Number_FD++; + if (type == FD_FILE) + open_disk_fd++; } void diff --git a/src/globals.h b/src/globals.h index ffb87de9ae..898c186294 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.66 1998/08/21 04:03:47 wessels Exp $ + * $Id: globals.h,v 1.67 1998/09/09 20:05:49 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -142,3 +142,4 @@ extern time_t delay_pools_last_update; /* 0 */ extern int refresh_nocache_hack; /* 0 */ #endif extern request_flags null_request_flags; +extern int open_disk_fd; /* 0 */ diff --git a/src/stat.cc b/src/stat.cc index 935507a822..268375e302 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.284 1998/09/04 23:05:02 wessels Exp $ + * $Id: stat.cc,v 1.285 1998/09/09 20:05:50 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -572,6 +572,8 @@ info_get(StoreEntry * sentry) Squid_MaxFD - Number_FD); storeAppendPrintf(sentry, "\tReserved number of file descriptors: %4d\n", RESERVED_FD); + storeAppendPrintf(sentry, "\tDisk files open: %4d\n", + open_disk_fd); storeAppendPrintf(sentry, "Internal Data Structures:\n"); storeAppendPrintf(sentry, "\t%6d StoreEntries\n", diff --git a/src/store.cc b/src/store.cc index 0720f88ebd..62a1bebb89 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.454 1998/09/09 16:47:08 wessels Exp $ + * $Id: store.cc,v 1.455 1998/09/09 20:05:52 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -456,7 +456,7 @@ struct _store_check_cachable_hist { int negative_cached; int too_big; int private_key; - int http_median_too_high; + int too_many_open_files; int lru_age_too_low; } no; struct { @@ -492,12 +492,9 @@ storeCheckCachable(StoreEntry * e) } else if (EBIT_TEST(e->flag, KEY_PRIVATE)) { debug(20, 3) ("storeCheckCachable: NO: private key\n"); store_check_cachable_hist.no.private_key++; -#if WIP - } else if (statMedianSvc(5, MEDIAN_HTTP) > 2000.0) { - debug(20, 2) ("storeCheckCachable: NO: median HTTP svc time = %d\n", - statMedianSvc(5, MEDIAN_HTTP)); - store_check_cachable_hist.no.http_median_too_high++; -#endif + } else if (Config.max_open_disk_fds && open_disk_fd > Config.max_open_disk_fds) { + debug(20, 2) ("storeCheckCachable: NO: too many disk files open\n"); + store_check_cachable_hist.no.too_many_open_files++; } else if (storeExpiredReferenceAge() < 300) { debug(20, 2) ("storeCheckCachable: NO: LRU Age = %d\n", storeExpiredReferenceAge()); @@ -528,8 +525,8 @@ storeCheckCachableStats(StoreEntry * sentry) store_check_cachable_hist.no.too_big); storeAppendPrintf(sentry, "no.private_key\t%d\n", store_check_cachable_hist.no.private_key); - storeAppendPrintf(sentry, "no.http_median_too_high\t%d\n", - store_check_cachable_hist.no.http_median_too_high); + storeAppendPrintf(sentry, "no.too_many_open_files\t%d\n", + store_check_cachable_hist.no.too_many_open_files); storeAppendPrintf(sentry, "no.lru_age_too_low\t%d\n", store_check_cachable_hist.no.lru_age_too_low); storeAppendPrintf(sentry, "yes.default\t%d\n", diff --git a/src/structs.h b/src/structs.h index 9aaba6d3a3..6f6f5ac689 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.218 1998/09/09 18:18:05 wessels Exp $ + * $Id: structs.h,v 1.219 1998/09/09 20:05:54 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -430,6 +430,7 @@ struct _SquidConfig { int icp_min_poll; int http_min_poll; } comm_incoming; + int max_open_disk_fds; }; struct _SquidConfig2 {