Re: mem_node memory usage in 2.x

From: Amos Jeffries <squid3@dont-contact.us>
Date: Tue, 22 Apr 2008 17:56:03 +1200

Adrian Chadd wrote:
> (This also may be an issue in Squid-3, as the mem_node class stores the data
> inline.)
>
> I did a little poking with the FreeBSD allocator - it allocates non-tiny
> objects on page boundaries with a size rounded up to the next page.
>
> [adrian@sarah ~]$ ./test1 test1 131072
> allocating 12, then 4096 byte structures 131072 times..
> RSS: 536868
> [adrian@sarah ~]$ ./test1 test2 131072
> allocating 4108 byte structure 131072 times..
> RSS: 1059244
>
> The source is available here:
>
> http://www.creative.net.au/diffs/mem-size.c
>
> I believe newer allocators do this sort of thing. Could people on other platforms
> (Linux, Solaris, Windows? :) give the above a whirl and let me know what the
> output is?
>
> I'm going to revisit my (much) earlier work which folded the 4k buffer into the
> mem_node and look at unwinding it. Its easy to do everywhere -except- the write
> path and thats all very dirty.
>
> That -should- drop the memory usage for large memory caches a bit.
> It'll increase the allocator usage a bit but then there are other
> much larger abuses of the allocator out there.
>
> Comments?

I gave it a try on Linux.

Once all the compile errors were fixed the testing code produced "RSS:
0" for both run cases.

Amos

-- 
Please use Squid 2.6.STABLE19 or 3.0.STABLE4
Received on Tue Apr 22 2008 - 13:02:15 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT