Forum Moderators: phranque

Message Too Old, No Replies

Why does each Apach child process consume 5MB of RAM?

         

John Carpenter

10:38 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



We are running Apache 1.3.33 (PHP 4.3.10, MySQL 4.1) on Debian 3.1 and noticed that each Apache child process takes 5 MB of RAM as soon as it is created (i.e. 5 MB per connection).

Does anybody know what causes it and how we could reduce that to 1 MB or less? Thanks.

moltar

10:56 pm on Jul 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What modules do you load in apache?

mod_perl can cause the bloat very easily if you preload many modules.

John Carpenter

9:04 am on Jul 28, 2005 (gmt 0)

10+ Year Member



The following modules are loaded:

mod_php4.c, mod_ssl.c, mod_setenvif.c, mod_expires.c, mod_auth.c, mod_access.c, mod_rewrite.c, mod_alias.c, mod_cgi.c, mod_dir.c, mod_autoindex.c, mod_info.c, mod_status.c, mod_negotiation.c, mod_mime.c, mod_mime_magic.c, mod_log_config.c, mod_chroot.c, mod_macro.c, mod_so.c, http_core.c

moltar

3:20 pm on Jul 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks ok to me. Another thing to consider is that apache uses shared memory, but the child processes will show the total memory used. What I mean is that it might show 5MB each, but in reality, it may only have 1MB per thread, and 4MB shared between all of them. See how much actual memory is used after you start apache.

John Carpenter

4:49 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



Yes, but this probably applies only to Apache 2.x. If I recall correctly, Apache 1.3.x does not support threads. All connections get separate processes, without sharing any memory (unlike in Apache 2.x).

We were actually going to try Apache 2.x (and 2.6.x Linux kernel) but some PHP guys don't recommend it as many php libs aren't thread safe. Anyone knows if MySQL libs are thread-safe today?

Thanks.