Subject: Re: [vserver] hashify and memory saving
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Fri, 1 Jan 2016 22:25:06 +0100

On Fri, Jan 01, 2016 at 09:37:52PM +0100, Tor Rune Skoglund wrote:
> Hello List,

Happy New Year!

> Having been a happy linux-vserver user for more than 10 years  
> now, it was about time to test the hashify feature. The disk   
> savings are obvious, and easily measured, but I have been      
> trying a lot harder to measure any possible run-time memory    
> savings. 

> For the testing, I created a simple template LAMP guest, and
> a lot of hashified guests cloned from that one. I am unable
> to measure noticeably less memory usage when running multiple
> hashified guests compared to non-hashified ones using free and
> /proc/meminfo/'s MemAvailable entry.

> However, this could very well be to shortcomings in my own
> understanding how this should work or what to look for.

> What should I look for regarding possible memory savings? 
> Anyone with any pointers?

You won't see any memory savings with dynamic memory allocations
and you won't get any benefits on read-write mappings either,
but you should be able to see a reduction for read only mappings
like they happen when using static binaries or read only mapped
shared libraries as well as read only memory mapped data files.

If I would devise a test to show the advantages, I would run a
binary which doesn't do many dynamic allocations but uses a lot
of code and/or libraries and run it as only process in each guest
with a few thousand guests in parallell, once with and without
unification in place.

Best,
Herbert

> This is Gentoo, util-vserver 0.30.216_pre3120, kernel Linux amd64 
> 3.18.7-vs2.3.7.4.

> BR, Tor Rune Skoglund
> trs@swi.no
>