Re: [vserver] number of vserver guests

From: Corey Wright <undefined_at_pobox.com>
Date: Sun 14 Mar 2010 - 09:53:51 GMT
Message-Id: <20100314045351.578c9585.undefined@pobox.com>

On Sat, 13 Mar 2010 10:55:50 -0500
"John A. Sullivan III" <jsullivan@opensourcedevel.com> wrote:

> On Sat, 2010-03-13 at 05:22 +0000, ben@bristolwireless.net wrote:
> > Quoting "Corey Wright" <undefined@pobox.com>:
> >
> > >
> > > 1255741670 M * Bertl good, so now your guests are unified ...
> > > 1255741691 M * Bertl they will consume less disk space, less memory
> > > and run faster overall
> > >
> > > from http://irc.13thfloor.at/LOG/2009-10/LOG_2009-10-17.txt
> >
> > It's true, the reduced memory comes as vhashify hardlinks identical
> > files, so for example if you had 200 guests using _exactly the same_
> > apache2 binary, it would only be loaded once, as it is hardlinked
> > accross guests i.e. the same file.
> <snip>
> That's interesting. I'd like to pursue this a bit, if I may because
> that's what I originally expected in VServer but I don't think it is
> what I am seeing. For example, we are running many vservers with KDE
> desktops. I was expecting that since they are all looking at the same
> hardlinked X and KDE files,memory usage would be minimal. However, we
> see each vserver consuming between 500MB and 1GB of RAM (from
> vserver-stat).
>
> Our observation is only that; we are not yet at the point in the project
> where we are analyzing where all the memory is going but we would have
> expected one instance of 500MB to 1GB and the rest only holding user
> data. Again, no need to spend a lot of time on it as we have not yet
> done our homework but any initial thoughts? Thanks - John

on my server i have several web application specific guests, 9 of them
running debian lenny + apache + php5. vserver-stat reports most of those 9
guests each using ~0.5 GB VSZ and ~30 MB RSS, with the remainder using
more. htop says i'm using ~2 GB of RAM (apart from buffers & cache, and no
swap), so obviously adding up VSZ does not equal RAM usage, but if you add
up all guests' RSS, it does equal ~2 GB. so when you say vserver-stat is
reporting 0.5 to 1 GB per guest, is the VSZ or RSS?

memory is a tricky thing and i do not claim to have a firm grasp of it,
specifically in the area of accounting (because the accounting rules are
different for each tool).

how is vserver-stat accounting memory? is memory mapped to files (whether
shared libraries or text segments of executables) accounted in full to
every vserver that is using that library/executable, or is it divided
equally among all applicable vservers? some process-based (eg top, ps)
tools account the full amount to each process (which is easy to tally per
process, but over-inflates the total for all processes), while some divide
the usage equally among the applicable processes (more representative of
overall system, but harder to calculate). what about data segments that
haven't been dirtied (and therefor haven't been copied-on-write)?

the best answer is probably: ask herbert or daniel for specifics.

i believe using a tool like pmap or memstat is helpful in general, but i
don't know for linux-vserver specifically, because of files appearing in
different namespaces separate from the queried context (ie 1). for
example, "pmap -d $(pgrep -f apache)" works in a guest running apache, but
"chcontext --silent --ctx 1 pmap -d $(chcontext --silent --ctx 1 pgrep -f
apache)" does not work properly from the host (ie it identifies all the
instances of apache, but is apparently unable to associate the memory
mappings to files outside of the current filesystem namespace).

regardless, i believe if you can find memory identified as unshared in a
guest (eg anonymous memory), then it will likely be unshared overall. on
my desktop, firefox and trackerd each use ~100 MB of user-specific
(data/cache) file-mapped and anonymous memory. that's 200 MB total just
for those two applications for one user. add in a couple of office
applications viewing/modifying documents, an audio player with a
user-specific media library database loaded into memory, etc and you have
0.5 to 1 GB per user, regardless of the number of vserver guests, so maybe
that explains your memory stats.

corey

-- 
undefined@pobox.com
Received on Sun Mar 14 11:20:08 2010
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sun 14 Mar 2010 - 11:20:09 GMT by hypermail 2.1.8