Home » Performance » LAMP » Apache memory usage is confusing
Apache memory usage is confusing [message #2649] Mon, 18 February 2008 10:07 Go to next message
razdaman  is currently offline razdaman
Messages: 26
Registered: May 2007
Junior Member
Hi guys,

I'm getting pretty confused about the numbers my apache web server is giving concerning memory usage.

By looking at 'top' I see that my httpd-processes eats around 14Mb of memory each. Through 'ps ax | grep httpd' I find out that I have around 200 running processes.

I thought this would mean that apache is consuming around 200 * 14Mb = 2800Mb om ram.

However, when looking at 'top' I see this:
Mem: 386M Active, 3122M Inact, 270M Wired, 209M Cache, 112M Buf, 8160K Free

3122M of 'inactive' memory out of a total of 4Gb. Apparently apache is not using around 2800mb as I thought.

What am I doing wrong here? In need to know how this works in order to tune the server appropriately.

I am using apache 2.2 with prefork on a FreeBSD box.

Thanks in advance...

[Updated on: Mon, 18 February 2008 10:08]

Re: Apache memory usage is confusing [message #2753 is a reply to message #2649 ] Tue, 18 March 2008 02:42 Go to previous messageGo to next message
debug  is currently offline debug
Messages: 132
Registered: March 2008
Senior Member

It could mean that memory is allocated for disk cache. It is not considered to be used, because at any time it can be used for something else.


Mikhail Solovyev, MySQL Performance Expert
MySQL Performance Blog
MySQL Consulting
Re: Apache memory usage is confusing [message #3558 is a reply to message #2649 ] Sun, 21 September 2008 21:15 Go to previous message
MarkRose  is currently offline MarkRose
Messages: 94
Registered: January 2008
Member
A lot of that 14 MB of memory is used by code, not data. When it's the exact same code (from the same file on disk), the operating system doesn't need to load multiple copies. However, as the code is stilled "linked" into the running process, it'll count towards the total memory used. This isn't just Apache code, but C libraries, etc. All programs on Unix-like systems work this way.

Windows was supposed to work this way, but due to issues with "dll hell" back in the 90's, most programmers switched to compiling a separate copy of the library into their programs, making Windows much less memory efficient.
Previous Topic:mysql tables for nagios
Next Topic:Amazon S3 replacement
Goto Forum:
  


Current Time: Fri Jul 10 02:48:10 EDT 2009

Total time taken to generate the page: 0.17324 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.