httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bram Mertens <mertensb.ma...@gmail.com>
Subject Re: [users@httpd] why doesn't mod_status show memory information?
Date Sat, 12 Jun 2010 07:56:19 GMT
On Sat, Jun 12, 2010 at 1:19 AM, Sean Conner <spc@conman.org> wrote:
> It was thus said that the Great Bram Mertens once stated:
>> Hi,
>>
>> http://httpd.apache.org/docs/2.0/misc/perf-tuning.html starts by
>> saying "The single biggest hardware issue affecting webserver
>> performance is RAM."
>>
>> However mod_status does not show information on memory consumption
>> while it does display information on CPU usage.
>>
>> This seems odd to me.  I have not been able to find any discussion on
>> this in the archives so far so I'm hoping someone can shed a light on
>> this.
>
>  It's not easy.  For example, one instance of Apache on my server (running
> Lniux) is showing it's using 11M of memory (output of "ps aux", which
> includes memory usage of each process), of which only 6M is actually in it's
> "resident set size", which according to the documentation for "ps":
>
>        resident set size, the non-swapped physical memory that a task has
>        used.
>
>  But of that 11M, a good portion of it is shared between *all* the
> instances of Apache---the actual code portion is shared between the Apache
> processes, and any data that actually hasn't been changed since a given
> child process started is at least shared with the parent (or main) process
> [1].  I'm not aware of any easy way to determine the amount of non-shared
> writable memory in a process.  That would be my guess.
>
>  -spc
>
> [1]     Linux, as well as many other Unix operating systems, use a concept
>        of "copy-on-write." Memory is broken up into what are called
>        "pages"---typically around 4k each and each 4k chunk is made visible
>        (or "mapped") to a process.  When a process creates a child process,
>        all the memory pages of the parent are visible to the child, but
>        they're marked "read-only" at this point.  Reguardless of who writes
>        some data, the operating system can detect this (since the page is
>        "read-only" and all writes are trapped), that page is then
>        duplicated, so there are now two pages in memory with the same
>        content.  One page is mapped into the parent and made read-write,
>        and the other one is mapped into the child and made read-write [2].
>        Now each process has their own private copy of just that one page.
>
>        It wouldn't surprise me if Windows works simularly, but since I
>        don't use Windows, I can't say for sure.
>
> [2]     It doesn't matter which is mapped since the instruction that did the
>        write will be re-executed anyway.

Thanks for the information.  From this I gather I'm more interested in
the overall memory usage of the server than that of apache itself.  So
I'll use those numbers.

Regards
Bram

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message