[squid-users] Squid 3.3 is very aggressive with memory

From: Nathan Hoad <nathan_at_getoffmalawn.com>
Date: Fri, 13 Dec 2013 12:50:31 +1100

Hi folks,

I'm in the process of coordinating a rollout of an update from 3.2 to
3.3, and I've been coming up against some memory issues.

Squid 3.3.x seems to use considerably more memory than 3.2 with the
same configuration. Looking at the logs I have, 3.3 is generally using
more than double the memory of 3.2 after extended use, but I think
it's unbounded as memory usage eventually grows until the system kills
it. The systems are 32 bit, so the memory limit imposed by the
architecture is what kills it.

I've written a custom malloc trace to track xmalloc() and friends, and
by the looks of things, Squid is not leaking nearly as much memory as
the resident shows. I can write at length about why I used this over
glibc's tools, but it was basically performance driven so I can run it
in a production environment.

I've also run Squid with jemalloc to test if the issue is heap
fragmentation, and test maximum vs actual memory usage by having
unused pages returned to the operating system. In less-pronounced
cases I do see the resident memory usage drop from time to time, but
typically not. This makes me wonder if it is heap fragmentation or a
genuine memory leak.

I did find one small memory leak that was introduced by the
server-first SSL bump feature in 3.3, which looks to have been fixed
in 3.4, but it doesn't look to be the main cause of the memory issues
I'm experiencing.

This leads me to believe that the objects that are consuming all of
the memory are genuinely using that memory, and are freed on shutdown.
The pools in the 'mem' cache manager page don't reflect this memory
usage at all, so I'm reasonably confident that it's of a type that
doesn't have memory pools, or are reported inaccurately by the pools.
Examples of these are the MemBuf and MemBlob objects, which contain
char* members and thus variable sizes.

So I'm basically at a loss as to what I can do now. Does anyone have
any ideas on what I can do to squash this problem?

Thanks,

Nathan.
Received on Fri Dec 13 2013 - 01:51:06 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 24 2013 - 12:00:05 MST