Hello.

We running cPanel-baserd web hosting server (x86_64, CentOS 5, Apache 1.3.37). Server started to get out of memory during pike hours. The reason is Apache childs that were 42mb each at that moment.

I`ve disabled most of the modules & tried to update to 1.3.39, but memory usage remained the same. After that I`ve reduced VirtualHost entries on this machine by about a half -- and memory usage droped to 27mb per child.

After that I`ve tried to migrate to 2.0. branch (it was hard to parse httpd.conf, because of syntax changes), but that resulted in only 2mb memory usage drops (27 to 25). I get back to 1.3.37.

We do not use mod_php or mod_perl (only mod_fastcgi).

Childs spawns at 27mb, they are not grow up to this (so decreasing MaxRequestsPerChild has no difference).

We have a machine with exact same setup (arch, OS, software versions, configuration), but with just ~80 VirtualHost entries and Apache uses ~4mb RSS on it.

Why Apache using that much memory and how could I decrease it?

Sorry for bad english.

Our current setup looks like this:
------------------------------------------
# /usr/local/apache/bin/httpd -v
Server version: Apache/1.3.37 (Unix)
Server built:   Apr  6 2007 18:23:14
[EMAIL PROTECTED] [~]# /usr/local/apache/bin/httpd -V
Server version: Apache/1.3.37 (Unix)
Server built:   Apr  6 2007 18:23:14
Server's Module Magic Number: 19990320:18
Server compiled with....
 -D EAPI
 -D HAVE_MMAP
 -D HAVE_SHMGET
 -D USE_SHMGET_SCOREBOARD
 -D USE_MMAP_FILES
 -D HAVE_FCNTL_SERIALIZED_ACCEPT
 -D HAVE_SYSVSEM_SERIALIZED_ACCEPT
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D DYNAMIC_MODULE_LIMIT=64
 -D HARD_SERVER_LIMIT=2048
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
 -D DEFAULT_LOCKFILE="logs/httpd.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 -D ACCESS_CONFIG_FILE="conf/access.conf"
 -D RESOURCE_CONFIG_FILE="conf/srm.conf"
------------------------------------------
# /usr/local/apache/bin/httpd -l
Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_access.c
  mod_auth.c
  mod_so.c
  mod_setenvif.c
  mod_ssl.c
  mod_frontpage.c
suexec: enabled; valid wrapper /usr/local/apache/bin/suexec
------------------------------------------
# egrep '^(Load|Add)Module' /etc/apache.conf
LoadModule rewrite_module     libexec/mod_rewrite.so
LoadModule bwlimited_module   libexec/mod_bwlimited.so
LoadModule bytes_log_module   libexec/mod_log_bytes.so
LoadModule fastcgi_module     libexec/mod_fastcgi.so
LoadModule expires_module     libexec/mod_expires.so
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_mime.c
AddModule mod_include.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_actions.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_so.c
AddModule mod_expires.c
AddModule mod_bwlimited.c
AddModule mod_log_bytes.c
AddModule mod_fastcgi.c
------------------------------------------
# grep -c '<VirtualHost' /etc/apache.conf
1055
------------------------------------------
# ldd /usr/local/apache/bin/httpd
        libm.so.6 => /lib64/tls/libm.so.6 (0x0000002a9566c000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000002a957f2000)
        libgdbm.so.2 => /usr/lib64/libgdbm.so.2 (0x0000002a95927000)
        libssl.so.4 => /lib64/libssl.so.4 (0x0000002a95a2d000)
        libcrypto.so.4 => /lib64/libcrypto.so.4 (0x0000002a95b69000)
        libexpat.so.0 => /usr/lib64/libexpat.so.0 (0x0000002a95d9a000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000002a95ebc000)
        libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a95fbf000)
        libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 
(0x0000002a961f5000)
        libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x0000002a9630b000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000002a9647c000)
        libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x0000002a9657f000)
        libz.so.1 => /usr/lib64/libz.so.1 (0x0000002a966a2000)
        /lib64/ld-linux-x86-64.so.2 (0x0000002a95556000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x0000002a967b6000)
------------------------------------------
# pwd
/usr/local/apache/conf
# cat srm.conf
# cat access.conf
#
------------------------------------------

Sample Vhost entry (most of them looks like this one):
------------------------------------------
<VirtualHost X.X.X.X Y.Y.Y.Y>
ServerAlias www.domain.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /home/user/public_html
ServerName domain.com

User user
Group user

BytesLog /usr/local/apache/domlogs/domain.com-bytes_log
CustomLog /usr/local/apache/domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/
</VirtualHost>
------------------------------------------

Memory usage info:
------------------------------------------
# ps -U nobody -orss,size,vsize,cmd|head
 RSS SZ  VSZ CMD
27908 27372 54660 /usr/local/apache/bin/httpd
28052 27488 54776 /usr/local/apache/bin/httpd
28032 27428 54716 /usr/local/apache/bin/httpd
28076 27508 54796 /usr/local/apache/bin/httpd
28112 27548 54836 /usr/local/apache/bin/httpd
27892 27320 54608 /usr/local/apache/bin/httpd
28012 27456 54744 /usr/local/apache/bin/httpd
28056 27440 54728 /usr/local/apache/bin/httpd
27872 27476 54764 /usr/local/apache/bin/httpd
------------------------------------------

mod_bwlimited.c/mod_log_bytes.c is a third party (cPanel) modules for bandwith limitation of the VirtualHosts. Tried to disable them (and mostof the other modules as well) and that gived me only few hundreeds kb drop in memory usage.

--
Sergey Avdushkin

---------------------------------------------------------------------
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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to