From: wessels <> Date: Tue, 1 Feb 2000 12:52:15 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~2065 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=279447ff4891c5a95b5065fa4e9678c3909dfdb7;p=thirdparty%2Fsquid.git DW: - This fixes an ugly and probably old bug with hot objects. Previously, storeSwapOut was too aggressive in freeing lower parts of in-memory objects. It would free up to how ever much was sent to the client, or how much had been saved to disk, whichever was lower. When the object response is complete, it is saved in memory only if mem->inmem_lo was equal to zero. Thus, many objects which could potentially be held in memory wouldn't be, because the lower part had been freed in storeSwapOut. This change doesn't free the lower part until the hi-lo gap is at least DISK_PAGE_SIZE (8192 bytes). This means that in-memory hot objects should mostly be 8kb or less. This change makes a very significant improvement in memory hit ratio. --- diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 5e4324e890..0115628388 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.60 2000/01/11 06:02:54 wessels Exp $ + * $Id: store_swapout.cc,v 1.61 2000/02/01 05:52:15 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -108,7 +108,10 @@ storeSwapOut(StoreEntry * e) lowest_offset = storeLowestMemReaderOffset(e); debug(20, 7) ("storeSwapOut: lowest_offset = %d\n", (int) lowest_offset); - new_mem_lo = lowest_offset; + if (mem->inmem_hi - lowest_offset > DISK_PAGE_SIZE) + new_mem_lo = lowest_offset; + else + new_mem_lo = mem->inmem_lo; assert(new_mem_lo >= mem->inmem_lo); if (storeSwapOutAble(e)) { /* @@ -119,11 +122,11 @@ storeSwapOut(StoreEntry * e) */ if ((on_disk = storeSwapOutObjectBytesOnDisk(mem)) < new_mem_lo) new_mem_lo = on_disk; - } else { + } else if (new_mem_lo > 0) { /* - * Its not swap-able, so we must make it PRIVATE. Even if - * be only one MEM client and all others must read from - * disk. + * Its not swap-able, and we're about to delete a chunk, + * so we must make it PRIVATE. This is tricky/ugly because + * for the most part, we treat swapable == cachable here. */ storeReleaseRequest(e); }