Search squid archive

Re: top reports twice memory as much as Total in mgr:mem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently running two instances behind round-robin load balanced DNS,
one with the following patch(bug3068_mk2.patch with several twists to
apply to 3.1.6), the other without. Wish to get some testification.

diff -Nur squid-3.1.6.orig/src/fs/coss/store_dir_coss.cc
squid-3.1.6/src/fs/coss/store_dir_coss.cc
--- squid-3.1.6.orig/src/fs/coss/store_dir_coss.cc      2010-08-01
22:01:39.000000000 +0800
+++ squid-3.1.6/src/fs/coss/store_dir_coss.cc   2010-10-25
21:56:00.816496622 +0800
@@ -996,8 +996,8 @@
 CossSwapDir::statfs(StoreEntry & sentry) const
 {
     storeAppendPrintf(&sentry, "\n");
-    storeAppendPrintf(&sentry, "Maximum Size: %d KB\n", max_size);
-    storeAppendPrintf(&sentry, "Current Size: %d KB\n", cur_size);
+    storeAppendPrintf(&sentry, "Maximum Size: %lu KB\n", max_size);
+    storeAppendPrintf(&sentry, "Current Size: %lu KB\n", cur_size);
     storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n",
                       100.0 * cur_size / max_size);
     storeAppendPrintf(&sentry, "Number of object collisions: %d\n",
(int) numcollisions);
@@ -1095,7 +1095,7 @@
 void
 CossSwapDir::dump(StoreEntry &entry)const
 {
-    storeAppendPrintf(&entry, " %d", max_size >> 10);
+    storeAppendPrintf(&entry, " %lu", max_size >> 10);
     dumpOptions(&entry);
 }

diff -Nur squid-3.1.6.orig/src/fs/ufs/store_dir_ufs.cc
squid-3.1.6/src/fs/ufs/store_dir_ufs.cc
--- squid-3.1.6.orig/src/fs/ufs/store_dir_ufs.cc        2010-08-01
22:01:39.000000000 +0800
+++ squid-3.1.6/src/fs/ufs/store_dir_ufs.cc     2010-10-25
22:26:58.629016115 +0800
@@ -82,7 +82,7 @@

     /* just reconfigure it */
     if (reconfiguring) {
-        if (size == max_size)
+        if ((unsigned)size == max_size)
             debugs(3, 2, "Cache dir '" << path << "' size remains
unchanged at " << size << " KB");
         else
             debugs(3, 1, "Cache dir '" << path << "' size changed to
" << size << " KB");
@@ -314,8 +314,8 @@
     int x;
     storeAppendPrintf(&sentry, "First level subdirectories: %d\n", l1);
     storeAppendPrintf(&sentry, "Second level subdirectories: %d\n", l2);
-    storeAppendPrintf(&sentry, "Maximum Size: %d KB\n", max_size);
-    storeAppendPrintf(&sentry, "Current Size: %d KB\n", cur_size);
+    storeAppendPrintf(&sentry, "Maximum Size: %"PRIu64" KB\n", max_size);
+    storeAppendPrintf(&sentry, "Current Size: %"PRIu64" KB\n", cur_size);
     storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n",
                       100.0 * cur_size / max_size);
     storeAppendPrintf(&sentry, "Filemap bits in use: %d of %d (%d%%)\n",
@@ -380,7 +380,7 @@
     walker = repl->PurgeInit(repl, max_scan);

     while (1) {
-        if (cur_size < (int) minSize()) /* cur_size should be unsigned */
+        if (cur_size < minSize()) /* cur_size should be unsigned */
             break;

         if (removed >= max_remove)
@@ -1325,10 +1325,7 @@
 void
 UFSSwapDir::dump(StoreEntry & entry) const
 {
-    storeAppendPrintf(&entry, " %d %d %d",
-                      max_size >> 10,
-                      l1,
-                      l2);
+    storeAppendPrintf(&entry, " %"PRIu64" %d %d", (max_size >> 10), l1, l2);
     dumpOptions(&entry);
 }

diff -Nur squid-3.1.6.orig/src/SquidMath.cc squid-3.1.6/src/SquidMath.cc
--- squid-3.1.6.orig/src/SquidMath.cc   2010-08-01 22:01:38.000000000 +0800
+++ squid-3.1.6/src/SquidMath.cc        2010-10-25 21:49:36.436913647 +0800
@@ -7,6 +7,12 @@
     return b ? ((int) (100.0 * a / b + 0.5)) : 0;
 }

+int64_t
+Math::int64Percent(const int64_t a, const int64_t b)
+{
+    return b ? ((int64_t) (100.0 * a / b + 0.5)) : 0;
+}
+
 double
 Math::doublePercent(const double a, const double b)
 {
diff -Nur squid-3.1.6.orig/src/SquidMath.h squid-3.1.6/src/SquidMath.h
--- squid-3.1.6.orig/src/SquidMath.h    2010-08-01 22:01:39.000000000 +0800
+++ squid-3.1.6/src/SquidMath.h 2010-10-25 21:50:00.953836387 +0800
@@ -6,6 +6,7 @@
 {

 extern int intPercent(const int a, const int b);
+extern int64_t int64Percent(const int64_t a, const int64_t b);
 extern double doublePercent(const double, const double);
 extern int intAverage(const int, const int, int, const int);
 extern double doubleAverage(const double, const double, int, const int);
diff -Nur squid-3.1.6.orig/src/store_dir.cc squid-3.1.6/src/store_dir.cc
--- squid-3.1.6.orig/src/store_dir.cc   2010-08-01 22:01:38.000000000 +0800
+++ squid-3.1.6/src/store_dir.cc        2010-10-25 22:02:17.431379546 +0800
@@ -360,13 +360,13 @@
     storeAppendPrintf(&output, "Store Directory Statistics:\n");
     storeAppendPrintf(&output, "Store Entries          : %lu\n",
                       (unsigned long int)StoreEntry::inUseCount());
-    storeAppendPrintf(&output, "Maximum Swap Size      : %8ld KB\n",
-                      (long int) maxSize());
+    storeAppendPrintf(&output, "Maximum Swap Size      : %"PRIu64" KB\n",
+                      maxSize());
     storeAppendPrintf(&output, "Current Store Swap Size: %8lu KB\n",
                       store_swap_size);
-    storeAppendPrintf(&output, "Current Capacity       : %d%% used,
%d%% free\n",
-                      Math::intPercent((int) store_swap_size, (int) maxSize()),
-                      Math::intPercent((int) (maxSize() -
store_swap_size), (int) maxSize()));
+    storeAppendPrintf(&output, "Current Capacity       : %"PRId64"%%
used, %"PRId64"%% free\n",
+                      Math::int64Percent(store_swap_size, maxSize()),
+                      Math::int64Percent((maxSize() -
store_swap_size), maxSize()));
     /* FIXME Here we should output memory statistics */

     /* now the swapDir */
@@ -374,14 +374,14 @@
 }

 /* if needed, this could be taught to cache the result */
-size_t
+uint64_t
 StoreController::maxSize() const
 {
     /* TODO: include memory cache ? */
     return swapDir->maxSize();
 }

-size_t
+uint64_t
 StoreController::minSize() const
 {
     /* TODO: include memory cache ? */
@@ -827,22 +827,21 @@
     }
 }

-size_t
+uint64_t
 StoreHashIndex::maxSize() const
 {
-    int i;
-    size_t result = 0;
+    uint64_t result = 0;

-    for (i = 0; i < Config.cacheSwap.n_configured; i++)
+    for (int i = 0; i < Config.cacheSwap.n_configured; i++)
         result += store(i)->maxSize();

     return result;
 }

-size_t
+uint64_t
 StoreHashIndex::minSize() const
 {
-    size_t result = 0;
+    uint64_t result = 0;

     for (int i = 0; i < Config.cacheSwap.n_configured; i++)
         result += store(i)->minSize();
diff -Nur squid-3.1.6.orig/src/Store.h squid-3.1.6/src/Store.h
--- squid-3.1.6.orig/src/Store.h        2010-08-01 22:01:37.000000000 +0800
+++ squid-3.1.6/src/Store.h     2010-10-25 21:50:57.338757239 +0800
@@ -273,10 +273,10 @@
      * The maximum size the store will support in normal use.
Inaccuracy is permitted,
      * but may throw estimates for memory etc out of whack.
      */
-    virtual size_t maxSize() const = 0;
+    virtual uint64_t maxSize() const = 0;

     /** The minimum size the store will shrink to via normal housekeeping */
-    virtual size_t minSize() const = 0;
+    virtual uint64_t minSize() const = 0;

     /**
      * Output stats to the provided store entry.
diff -Nur squid-3.1.6.orig/src/StoreHashIndex.h squid-3.1.6/src/StoreHashIndex.h
--- squid-3.1.6.orig/src/StoreHashIndex.h       2010-08-01
22:01:37.000000000 +0800
+++ squid-3.1.6/src/StoreHashIndex.h    2010-10-25 21:51:29.130077308 +0800
@@ -63,9 +63,9 @@

     virtual void sync();

-    virtual size_t maxSize() const;
+    virtual uint64_t maxSize() const;

-    virtual size_t minSize() const;
+    virtual uint64_t minSize() const;

     virtual void stat(StoreEntry&) const;

diff -Nur squid-3.1.6.orig/src/SwapDir.cc squid-3.1.6/src/SwapDir.cc
--- squid-3.1.6.orig/src/SwapDir.cc     2010-08-01 22:01:37.000000000 +0800
+++ squid-3.1.6/src/SwapDir.cc  2010-10-25 21:52:20.474258607 +0800
@@ -81,11 +81,10 @@
 void
 SwapDir::maintain() {}

-size_t
+uint64_t
 SwapDir::minSize() const
 {
-    return (size_t) (((float) maxSize() *
-                      (float) Config.Swap.lowWaterMark) / 100.0);
+    return ((maxSize() * Config.Swap.lowWaterMark) / 100);
 }

 void
diff -Nur squid-3.1.6.orig/src/SwapDir.h squid-3.1.6/src/SwapDir.h
--- squid-3.1.6.orig/src/SwapDir.h      2010-08-01 22:01:39.000000000 +0800
+++ squid-3.1.6/src/SwapDir.h   2010-10-25 21:54:22.988852379 +0800
@@ -64,9 +64,9 @@

     virtual void maintain(); /* perform regular maintenance should be
private and self registered ... */

-    virtual size_t maxSize() const;
+    virtual uint64_t maxSize() const;

-    virtual size_t minSize() const;
+    virtual uint64_t minSize() const;

     virtual void stat(StoreEntry &) const;

@@ -133,9 +133,9 @@
     virtual void get
     (String const, STOREGETCLIENT, void * cbdata);

-    virtual size_t maxSize() const { return max_size;}
+    virtual uint64_t maxSize() const { return max_size;}

-    virtual size_t minSize() const;
+    virtual uint64_t minSize() const;
     virtual void stat (StoreEntry &anEntry) const;
     virtual StoreSearch *search(String const url, HttpRequest *) = 0;

@@ -157,8 +157,8 @@
     char const *theType;

 public:
-    int cur_size;
-    int max_size;
+    uint64_t cur_size;
+    uint64_t max_size;
     char *path;
     int index;                 /* This entry's index into the swapDirs array */
     int64_t max_objsize;
diff -Nur squid-3.1.6.orig/src/tests/testStore.cc
squid-3.1.6/src/tests/testStore.cc
--- squid-3.1.6.orig/src/tests/testStore.cc     2010-08-01
22:01:37.000000000 +0800
+++ squid-3.1.6/src/tests/testStore.cc  2010-10-25 22:04:12.974872739 +0800
@@ -31,13 +31,13 @@
 TestStore::init()
 {}

-size_t
+uint64_t
 TestStore::maxSize() const
 {
     return 3;
 }

-size_t
+uint64_t
 TestStore::minSize() const
 {
     return 1;
diff -Nur squid-3.1.6.orig/src/tests/testStore.h
squid-3.1.6/src/tests/testStore.h
--- squid-3.1.6.orig/src/tests/testStore.h      2010-08-01
22:01:37.000000000 +0800
+++ squid-3.1.6/src/tests/testStore.h   2010-10-25 22:04:37.135057635 +0800
@@ -55,9 +55,9 @@

     virtual void maintain() {};

-    virtual size_t maxSize() const;
+    virtual uint64_t maxSize() const;

-    virtual size_t minSize() const;
+    virtual uint64_t minSize() const;

     virtual void stat(StoreEntry &) const; /* output stats to the
provided store entry */

diff -Nur squid-3.1.6.orig/src/tests/TestSwapDir.cc
squid-3.1.6/src/tests/TestSwapDir.cc
--- squid-3.1.6.orig/src/tests/TestSwapDir.cc   2010-08-01
22:01:38.000000000 +0800
+++ squid-3.1.6/src/tests/TestSwapDir.cc        2010-10-25
22:02:55.766962512 +0800
@@ -3,7 +3,7 @@
 #include "squid.h"
 #include "TestSwapDir.h"

-size_t
+uint64_t
 TestSwapDir::maxSize() const
 {
     return 3;
diff -Nur squid-3.1.6.orig/src/tests/TestSwapDir.h
squid-3.1.6/src/tests/TestSwapDir.h
--- squid-3.1.6.orig/src/tests/TestSwapDir.h    2010-08-01
22:01:38.000000000 +0800
+++ squid-3.1.6/src/tests/TestSwapDir.h 2010-10-25 22:03:17.736828660 +0800
@@ -12,7 +12,7 @@

     bool statsCalled;

-    virtual size_t maxSize() const;
+    virtual uint64_t maxSize() const;
     virtual void stat(StoreEntry &) const; /* output stats to the
provided store entry */

     virtual void reconfigure(int, char*);




2010/10/25 Kaiwang Chen <kaiwang.chen@xxxxxxxxx>:
> Bad news.  I'm backporting it to 3.1.6 to have a try.
>
> kc
>
> 2010/10/25 Amos Jeffries <squid3@xxxxxxxxxxxxx>:
>> On 26/10/10 00:03, Kaiwang Chen wrote:
>>>
>>> The patch for bug 3068,
>>> http://bugs.squid-cache.org/attachment.cgi?id=2291&action=diff
>>> is not against 3.1.6?
>>
>> Was done on 3.1.8 or 3.HEAD. I think it should apply to either of those or
>> the 3.1.9.
>>
>> Amos
>> --
>> Please be using
>>  Current Stable Squid 2.7.STABLE9 or 3.1.8
>>  Beta testers wanted for 3.2.0.2
>>
>



[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux