Re: [squid-users] high memory usage (squid 3.2.0)

From: Alex Rousskov <>
Date: Wed, 10 Apr 2013 12:36:17 -0600

On 04/10/2013 09:22 AM, Mr Dash Four wrote:

> the total memory used of all objects placed in ram should
> not be 6 times the cache_mem value

There is no such rule or law of physics. cache_mem is not squid_mem (a
not-yet-supported option that would limit total Squid memory usage).

The total memory used by Squid is, roughly:

   1) initial memory used by Squid shortly after start +
   2) memory used to store memory-cached objects +
   3a) memory used to index memory-cached objects +
   3b) memory used to index disk-cached objects +
   4) memory used for current transactions +
   5) memory leaked since Squid start

cache_mem determines the maximum value of (2)

cache_mem and mean object size in memory cache determine the maximum
value of (3a) because they determine the maximum number of objects in
the memory cache.

cache_mem has no significant direct effect on the other four components.
Depending on the local circumstances, every other component alone may
exceed cache_mem 5 times or more, especially when cache_mem is
relatively small, e.g., 200MB. And taken together, they can exceed
6*cache_mem level even easier.

For example, a 10KB/s memory leak will consume 1GB of RAM in less than
two days. Similarly, an overloaded Squid may grow (4) at rates exceeding

Now back to your actual problem. An idle Squid with 200 MB memory cache
and 200 MB disk cache should not use 1.3GB of RAM unless component (1)
is very high due to some huge ACL lists or other unusual complications.
If your (1) is just a few MBs and your idle Squid uses 1.3GB, then I
would suspect a memory leak.

If you want to reduce Squid memory usage, I recommend eliminating memory
leaks as suspects first because they are bugs and because they may
consume all available RAM on your machine. Whether your Squid leaks
memory, I do not know. I do know that you are running v3.2.0 that
probably does have leaks and a set of other nasty bugs fixed in
currently supported Squid versions.


Received on Wed Apr 10 2013 - 18:36:34 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 11 2013 - 12:00:03 MDT