From: wessels <> Date: Sat, 11 Dec 1999 22:57:42 +0000 (+0000) Subject: Some changes to store hash_table buckets to improve performance. X-Git-Tag: SQUID_3_0_PRE1~2104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baf144ad696539ca710a0f2df7b62fe0dbea51c6;p=thirdparty%2Fsquid.git Some changes to store hash_table buckets to improve performance. The default is changed from 50 objects/bucket to 20. Rewrote storeKeyHashBuckets() and removed the 64K bucket limit. Users report this change makes a very big difference. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index ee96aae267..dbec2ae184 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.162 1999/10/04 05:05:01 wessels Exp $ +# $Id: cf.data.pre,v 1.163 1999/12/11 15:57:43 wessels Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -2265,14 +2265,14 @@ DOC_END NAME: store_objects_per_bucket TYPE: int -DEFAULT: 50 +DEFAULT: 20 LOC: Config.Store.objectsPerBucket DOC_START Target number of objects per bucket in the store hash table. Lowering this value increases the total number of buckets and - also the storage maintenance rate. The default is 50. + also the storage maintenance rate. The default is 20. -store_objects_per_bucket 50 +store_objects_per_bucket 20 DOC_END NAME: client_db diff --git a/src/store_key_md5.cc b/src/store_key_md5.cc index ef85fbf21e..d0d4ea344e 100644 --- a/src/store_key_md5.cc +++ b/src/store_key_md5.cc @@ -1,6 +1,6 @@ /* - * $Id: store_key_md5.cc,v 1.21 1999/04/23 02:57:38 wessels Exp $ + * $Id: store_key_md5.cc,v 1.22 1999/12/11 15:57:42 wessels Exp $ * * DEBUG: section 20 Storage Manager MD5 Cache Keys * AUTHOR: Duane Wessels @@ -142,15 +142,12 @@ storeKeyFree(const cache_key * key) } int -storeKeyHashBuckets(int nobj) +storeKeyHashBuckets(int nbuckets) { - if (nobj < 0x2000) - return 0x2000; - if (nobj < 0x4000) - return 0x4000; - if (nobj < 0x8000) - return 0x8000; - return 0x10000; + int n = 0x2000; + while (n < nbuckets) + n <<= 1; + return n; } int