Re: why doesn't mod_status show memory information?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux