]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Increased page size to 32KB so that most typical responses would fit
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Apr 2011 19:30:46 +0000 (13:30 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Apr 2011 19:30:46 +0000 (13:30 -0600)
until we support multi-page caching.

Made cumulative page size limit configurable via cache_mem.

Implemented Ipc::Mem::Limit().

src/ipc/mem/Pages.cc

index 4427481225b44c2a0e72a5ddc3d40f1c5fc5d7ab..34889043afd9d5cfea23297873f17748cc277670 100644 (file)
 static const String PagePoolId = "squid-page-pool";
 static Ipc::Mem::PagePool *ThePagePool = 0;
 
-// XXX: make configurable
+// TODO: make configurable to avoid waste when mem-cached objects are small/big
 size_t
 Ipc::Mem::PageSize() {
-       return 16*1024;
+    return 32*1024;
 }
 
 void
 Ipc::Mem::Init()
 {
     Must(!ThePagePool);
-    // XXX: pool capacity and page size should be configurable/meaningful
-    ThePagePool = new PagePool(PagePoolId, 1024, PageSize());
+    const size_t capacity = Limit() / PageSize();
+    ThePagePool = new PagePool(PagePoolId, capacity, PageSize());
 }
 
 void
@@ -44,8 +44,7 @@ Ipc::Mem::Attach()
 bool
 Ipc::Mem::GetPage(PageId &page)
 {
-    Must(ThePagePool);
-    return ThePagePool->get(page);
+    return ThePagePool ? ThePagePool->get(page) : false;
 }
 
 void
@@ -61,3 +60,15 @@ Ipc::Mem::PagePointer(const PageId &page)
     Must(ThePagePool);
     return ThePagePool->pagePointer(page);
 }
+
+size_t
+Ipc::Mem::Limit()
+{
+    // TODO: adjust cache_mem description to say that in SMP mode,
+    // in-transit objects are not allocated using cache_mem. Eventually,
+    // they should not use cache_mem even if shared memory is not used:
+    // in-transit objects have nothing to do with caching.
+    return Config.memMaxSize;
+}
+
+// TODO: Implement size_t Ipc::Mem::Level()