Re: [squid-users] top reports twice memory as much as Total in mgr:mem

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 20 Oct 2010 00:45:22 +1300

On 20/10/10 00:19, Roberto Suarez Soto wrote:
> El día Tue, 19 Oct 2010 23:48:07 +1300, Amos Jeffries<squid3_at_treenet.co.nz>
> escribía:
>
>>> Probably memory leak. However, it is not reliably reproducible.
>>> Anyway, a restart will return memory to OS.
>> see question 4 of the memory FAQ:
>> http://wiki.squid-cache.org/SquidFaq/SquidMemory
>
> Related to this, in question 6 says this:
>
> "Additionally, most operating systems do not allow processes to
> shrink in size. When a process gives up memory by calling free, the total
> process size does not shrink. So the process size really represents the
> maximum size your Squid process has reached."
>
> I'm not sure I understand this. Does it mean that Squid could grow a
> lot, beyond what cache_mem and other settings would imply, and then be unable
> to free memory even if it's not using it?

I believe modern allocators change it to what they call "virtual memory"
which does not actually exist when released. A piece of disk is "put
aside" instead in case something else needs to be swapped out there when
the app grows again.

>
> An example with numbers: suppose I have "cache_mem 50 MB" and
> "memory_pools_limit 50 MB", but that's not enough for my current load and
> squid grows to double that size. Even if the load of requests becomes very
> low afterwards, does it mean that it won't be able to shrink because the OS
> has already allocated memory for it?

It reads that way.

>
> In that case, would it be better to set a high cache_mem and
> memory_pools_limit value so it's squid who manages its memory? As I
> understand it, squid would get quite big from the start but then it wouldn't
> grow so much because it'd be able to manage its pool of memory. Does this
> make sense?

Sort of.

memory pools would work that way. It is an allocator same as the system
ones but tuned to Squid usage instead of generic page sizes.

cache_mem is a in-memory object cache. Its fill/empty cycles behave the
same as disk storage. So it will fill up and keep itself that way as
long as the machine is active and somebody "might" need the data stored.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.8
   Beta testers wanted for 3.2.0.2
Received on Tue Oct 19 2010 - 11:45:27 MDT

This archive was generated by hypermail 2.2.0 : Tue Oct 19 2010 - 12:00:02 MDT