[squid-users] Memory Leak Squid 3.4.9 on FreeBSD 10.0 x64

Amos Jeffries squid3 at treenet.co.nz
Wed Dec 10 16:21:54 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/12/2014 4:22 a.m., Doug Sampson wrote:
>> Nothing particularly stands out as leaking. Although the cache
>> memory pages (mem_node) in-use size is suspiciously close to half
>> what you say the OS is reporting.
>> 
>> That makes me suspect that your OS is rounding up its allocations
>> to 8KB of memory for each node. If that is the case the simplest 
>> workaround is to reduce cache_mem size down to below the point
>> where the box will swap.
> 
> Okay, I'll keep dropping the cache_mem down until the system stops
> swapping. Hopefully not too much.
> 
> Would it make sense to add additional memory in order to reduce the
> possibility of swapping? Say, 1GB more?

If you can afford that option, then yes.

> 
>> If you are game for it I have been wondering if we need to
>> enable chunking for 64-bit systems. To test that run squid with
>> environment variable MEMPOOLS=1. Memory should then be allocated
>> in larger blocks, but utilized much more compactly within those
>> blocks for an overall saving on objects like mem_node. It is
>> currently a rarely used feature though, so I'm not sure if there
>> are any issues hiding.
>> 
> 
> I'm reluctant to do this on a production server. Interfacing with
> our customers via social media et al is an important part of our
> business.
> 

Sure. No problem.

> Nevertheless, I looked into how the MEMPOOLS parameter could be
> implemented in a FreeBSD machine. I couldn't find a post that
> clearly indicates how to implement it. The nearest reference I
> could find was that FreeBSD implements UMA which apparently with my
> limited knowledge is a parallel memory implementation of MEMPOOLS.
> Correct me if I'm terribly mistaken.
> 

It is a shell environment variable Squid checks for when starting up.

Add the line:
  export MEMPOOLS=1

to the Squid init script, then run the script to restart the proxy.
likewise, remove the line and restart to stop using it.

NP: you may or may not need the "export" keyword depending on your shell.

Amos

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQEcBAEBAgAGBQJUiHMhAAoJELJo5wb/XPRjx7wIAIkcEUEvdQ+vN5QbtEhBxERK
7iofy58y5BgPkoargu2BkLJXmLd+mAuanJOslL45RAyp1BlBJuDVi+rGX/rGvIBj
OOFbnIx99qbyysG4gkZcqu8S3TESzfJyQ8QTFGB39GK69fNXTymcK2+S+3GVLW/P
9u95j9EwMCYw5BZQcd5QJhaoLQqrkQeJ7/7jNXcB/7AEs5Ho4xT07tV66RS9c0BK
SUQrYEbYHOx+Xm4dOf2e1oF8JD8ilZ+Hyn+/7+pRMVkbvMN3fq/nG6Ibrhoo2CU+
JcwfK0a7/pgbEiJPb7TDCiaPjIHnkXnyI4d8eBRvEDbLytww3gXuETuqD/1OBFg=
=v4R3
-----END PGP SIGNATURE-----


More information about the squid-users mailing list