[Gllug] PS - memory use

Christian Smith csmith at micromuse.com
Mon Mar 21 15:53:07 UTC 2005


On Fri, 18 Mar 2005, Alain Williams wrote:

>On Fri, Mar 18, 2005 at 04:59:30PM +0000, Nix wrote:
>> On Thu, 17 Mar 2005, Richard Jones suggested tentatively:
>> > On Thu, Mar 17, 2005 at 03:33:01PM +0000, Alain Williams wrote:
>> >> Just to make it more complicated I don't want to double count, if I
>> >> have several httpd processes I don't want to add up the memory that
>> >> contains the code several times but once. I want to count shared
>> >> memory (primarily .so files).
>> >
>> > This isn't so simple.  For instance, how are you going to account for
>> > copy-on-write mappings between processes?  These show up in
>> > /proc/*/maps, but not in a way which tells you how many pages have
>> > actually been copied.
>
> [snip]
>
>I didn't think that it was that easy. What I am trying to do is to work
>out how much memory I need on a box so that it doesn't swap. Given X
>apache processes, Y mysql processes, etc, etc. Using top/ps shows what it
>is doing now, but it doesn't really help me to be sure where the memory
>is going.
>

What's specifically wrong with swapping? The benefit of virtual memory is
that you shouldn't need to know how much memory is being used, just how
much is required to avoid thrashing. That can be done relatively easily
through observation.

In fact, given the time required to do this tuning and accounting, it
would probably be more cost effective to just throw extra RAM into the box
and ignore the problem. Overestimate memory usage and you should be fine.

Operating systems will often speculatively swap memory out, just so the
memory can be marked clean and reused without further ado when needed.
This often gives the impression that a box is under memory pressure that
isn't actually there. Just because the swap is in use, doesn't mean the
memory backed by the swap isn't already in memory.

Christian

-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list