LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-18-2006, 09:54 AM   #1
CelticSoul
LQ Newbie
 
Registered: Oct 2005
Posts: 7

Rep: Reputation: 0
httpd uses too much memory


I'm running Linux 2.4.20-8smp, Apache 2.0.44, Tomcat 5 with 512MB RAM

This is my top:

Code:
 2935 nobody    16   0 17568  15M  2112 R    32.7  3.0   0:03   1 httpd
 2897 nobody    17   0 18008  15M  2120 R    26.4  3.1   0:07   1 httpd
 2919 nobody    16   0 17696  15M  2112 S    11.1  3.1   0:09   0 httpd
 2376 nobody    15   0 19692  15M  2128 S    10.2  3.0   0:09   0 httpd
 2590 nobody    16   0 17624  14M  2088 R     6.8  2.8   0:17   0 httpd
 2756 mysql     15   0 15992 6508  1640 D     4.3  1.2   0:02   0 mysqld
 2941 mysql     15   0 15992 6512  1640 D     4.1  1.2   0:00   0 mysqld
 2754 nobody    16   0 26604  24M  2104 S     2.9  4.7   0:20   0 httpd
 2909 nobody    15   0 16548  14M  2080 S     2.5  2.8   0:00   1 httpd
 2939 mysql     15   0 15992 6512  1640 S     0.9  1.2   0:00   1 mysqld
 2823 mysql     15   0 15992 6508  1640 S     0.7  1.2   0:01   0 mysqld
 2945 root      24   0  6132 6132  4624 R     0.7  1.1   0:00   1 java
This is my cat /proc/meminfo:
Code:
MemTotal:       513240 kB
MemFree:         53976 kB
MemShared:           0 kB
Buffers:         10976 kB
Cached:         125528 kB
SwapCached:      57740 kB
Active:         398624 kB
ActiveAnon:     285604 kB
ActiveCache:    113020 kB
Inact_dirty:     20108 kB
Inact_laundry:    9636 kB
Inact_clean:     10428 kB
Inact_target:    87756 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       513240 kB
LowFree:         53976 kB
SwapTotal:     1044216 kB
SwapFree:       955588 kB
This is my ps aux
Code:
root         1  0.1  0.0  1368   76 ?        S    14:15   0:04 init
root         2  0.0  0.0     0    0 ?        SW   14:15   0:00 [migration/0]
root         3  0.0  0.0     0    0 ?        SW   14:15   0:00 [migration/1]
root         4  0.0  0.0     0    0 ?        SW   14:15   0:00 [keventd]
root         5  0.0  0.0     0    0 ?        SWN  14:15   0:02 [ksoftirqd_CPU0]
root         6  0.0  0.0     0    0 ?        SWN  14:15   0:00 [ksoftirqd_CPU1]
root        11  0.0  0.0     0    0 ?        SW   14:15   0:00 [bdflush]
root         7  0.0  0.0     0    0 ?        SW   14:15   0:01 [kswapd]
root         8  0.0  0.0     0    0 ?        SW   14:15   0:00 [kscand/DMA]
root         9  0.1  0.0     0    0 ?        SW   14:15   0:02 [kscand/Normal]
root        10  0.0  0.0     0    0 ?        SW   14:15   0:00 [kscand/HighMem]
root        12  0.0  0.0     0    0 ?        SW   14:15   0:00 [kupdated]
root        13  0.0  0.0     0    0 ?        SW   14:15   0:00 [mdrecoveryd]
root        22  0.0  0.0     0    0 ?        SW   14:15   0:00 [kjournald]
root        80  0.0  0.0     0    0 ?        SW   14:15   0:00 [khubd]
root      1163  0.0  0.0     0    0 ?        SW   14:15   0:00 [kjournald]
root      1472  0.0  0.0  1444  152 ?        S    14:15   0:00 syslogd -m 0
root      1476  0.0  0.0  1364    4 ?        S    14:15   0:00 klogd -x
rpc       1494  0.0  0.0  1544    0 ?        SW   14:15   0:00 [portmap]
rpcuser   1513  0.0  0.0  1520    0 ?        SW   14:15   0:00 [rpc.statd]
root      1610  0.0  0.0  3504  284 ?        S    14:15   0:00 /usr/sbin/sshd
root      1624  0.0  0.0  2028    4 ?        S    14:15   0:00 xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid
root      1633  0.0  0.0  3460    4 ?        S    14:15   0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root      1653  0.0  0.1  5912  532 ?        S    14:15   0:00 [sendmail]
smmsp     1662  0.0  0.0  5712    0 ?        SW   14:15   0:00 [sendmail]
root      1673  0.0  0.0  1412    4 ?        S    14:15   0:01 gpm -t ps/2 -m /dev/mouse
root      1688  0.0  0.3 14052 1728 ?        S    14:15   0:00 /opt/apache2/bin/httpd -k start
root      1696  0.0  0.0  1424  344 ?        S    14:15   0:00 crond
root      1713  0.0  0.0  7488  312 ?        S    14:16   0:00 cupsd
root      1751  0.0  0.0  4184    4 ?        S    14:16   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.loca
mysql     1779  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
root      1781  0.0  0.0  1436    4 ?        S    14:16   0:00 jsvc.exec -user app -home /usr/java/jdk1.5.0_01 -Dcatalina.home=/opt/jakarta-tomcat-5.5.7 -Dja
app       1782  1.2  7.0 295568 36104 ?      S    14:16   0:32 [jsvc]
mysql     1783  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1784  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1785  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1786  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1787  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1789  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1790  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1791  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
mysql     1792  0.0  1.3 37452 7044 ?        S    14:16   0:00 [mysqld]
daemon    1823  0.0  0.0  1408  164 ?        S    14:16   0:00 [atd]
root      1831  0.0  0.0  1348    4 tty1     S    14:16   0:00 /sbin/mingetty tty1
root      1832  0.0  0.0  1348    4 tty2     S    14:16   0:00 /sbin/mingetty tty2
root      1833  0.0  0.0  1348    4 tty3     S    14:16   0:00 /sbin/mingetty tty3
root      1834  0.0  0.0  1348    4 tty4     S    14:16   0:00 /sbin/mingetty tty4
root      1835  0.0  0.0  1348    4 tty5     S    14:16   0:00 /sbin/mingetty tty5
root      1836  0.0  0.0  1348    4 tty6     S    14:16   0:00 /sbin/mingetty tty6
nobody    2754  3.2  3.6 34880 18896 ?       S    14:42   0:32 [httpd]
mysql     2756  0.3  1.3 37452 7044 ?        S    14:42   0:03 [mysqld]
root      2843  0.0  0.2  6848 1424 ?        S    14:46   0:00 /usr/sbin/sshd
root      2847  0.0  0.2  4408 1268 pts/1    S    14:47   0:00 -bash
nobody    2899  3.2  5.0 36160 25980 ?       S    14:47   0:22 [httpd]
mysql     2901  0.2  1.3 37452 7044 ?        S    14:47   0:01 [mysqld]
nobody    2911  1.2  3.0 25980 15856 ?       S    14:48   0:08 [httpd]
nobody    2935  2.7  3.0 25880 15836 ?       S    14:49   0:16 [httpd]
mysql     2939  0.1  1.3 37452 7044 ?        S    14:49   0:00 [mysqld]
nobody    2991  2.1  3.1 26084 16120 ?       S    14:51   0:10 [httpd]
mysql     2994  0.0  1.3 37452 7044 ?        S    14:51   0:00 [mysqld]
nobody    3010  3.2  3.1 26232 16196 ?       S    14:52   0:13 [httpd]
nobody    3011  3.4  4.7 34444 24308 ?       S    14:52   0:14 [httpd]
mysql     3014  0.2  1.3 37452 7044 ?        S    14:52   0:01 [mysqld]
mysql     3015  0.4  1.3 37452 7044 ?        S    14:52   0:01 [mysqld]
mysql     3023  0.0  1.3 37452 7044 ?        S    14:53   0:00 [mysqld]
nobody    3024  2.9  3.1 26292 16176 ?       S    14:53   0:10 [httpd]
mysql     3025  0.0  1.3 37452 7044 ?        S    14:53   0:00 [mysqld]
nobody    3026  1.1  4.2 33516 22020 ?       S    14:53   0:04 [httpd]
mysql     3029  0.2  1.3 37452 7044 ?        S    14:54   0:00 [mysqld]
nobody    3032  2.8  3.1 25896 15924 ?       S    14:54   0:08 [httpd]
mysql     3037  0.0  1.3 37452 7044 ?        S    14:54   0:00 [mysqld]
nobody    3048  1.9  3.1 25952 16196 ?       S    14:54   0:05 [httpd]
nobody    3049  1.9  3.1 25892 15956 ?       S    14:54   0:05 [httpd]
mysql     3052  0.0  1.3 37452 7044 ?        S    14:54   0:00 [mysqld]
nobody    3086  5.8  3.1 26188 16288 ?       S    14:55   0:13 [httpd]
mysql     3087  0.1  1.3 37452 7044 ?        S    14:55   0:00 [mysqld]
nobody    3101  4.5  3.1 25888 15948 ?       R    14:56   0:08 [httpd]
nobody    3103  2.0  3.1 26076 16116 ?       S    14:56   0:03 [httpd]
nobody    3105  0.2  2.5 23384 13036 ?       S    14:56   0:00 [httpd]
mysql     3107  0.0  1.3 37452 7044 ?        S    14:56   0:00 [mysqld]
mysql     3113  0.0  1.3 37452 7044 ?        S    14:56   0:00 [mysqld]
mysql     3116  0.0  1.3 37452 7044 ?        S    14:56   0:00 [mysqld]
mysql     3127  0.1  1.3 37452 7044 ?        S    14:57   0:00 [mysqld]
nobody    3137  4.5  5.0 36188 26148 ?       S    14:57   0:05 [httpd]
nobody    3140  6.7  5.2 36888 26868 ?       S    14:57   0:07 [httpd]
mysql     3141  0.5  1.3 37452 7044 ?        S    14:57   0:00 [mysqld]
mysql     3144  0.6  1.3 37452 7044 ?        S    14:57   0:00 [mysqld]
nobody    3158  5.5  3.1 26108 16124 ?       S    14:58   0:02 [httpd]
mysql     3161  0.2  1.3 37452 7044 ?        S    14:58   0:00 [mysqld]
nobody    3163  3.3  3.0 25708 15696 ?       S    14:59   0:00 [httpd]
mysql     3164  0.0  1.3 37452 7044 ?        S    14:59   0:00 [mysqld]
root      3165  0.0  0.1  2668  740 pts/1    R    14:59   0:00 ps aux
Apache conf file:

Timeout 300
KeepAlive On
MaxKeepAliveRequests 50
KeepAliveTimeout 2


There are only a few web user but apache is using up he memory real fast and it caused the server hang.

Please help, Thanks
 
Old 04-19-2006, 07:55 PM   #2
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
What modules do you have loaded in Apache? See if you can run "http://[address of server]/server-info" and post the list of modules loaded. Or you can post the module list from your httpd.conf file.

Which MPM are you using?

Peace...
 
Old 04-19-2006, 09:13 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Looking at your MemTotal/Free, SwapTotal/Free looks normal to me. Linux caches as much stuff in RAM as possible. You've normally only got a prob if SwapFree is small, means a runaway mem oriented process
 
Old 04-19-2006, 09:50 PM   #4
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
The thing is, he's indicating a server crash. Not sure if that's memory use related or not.

Peace...
 
Old 04-20-2006, 09:23 PM   #5
CelticSoul
LQ Newbie
 
Registered: Oct 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Guys, thanks for your help.
I upgraded the server to 1GB RAM now.

For a temperory solution I put a line in crontab to restart httpd every 10 mins. So far, the server did not crash anymore. But this is not what I'm looking for.
I hope with your help, I can pinpoint the problem.

For MPM, I'm not sure which one I'm using, cause I can't run "server-info" thingy.

Code:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients         100
MaxRequestsPerChild  0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         100
MinSpareThreads     25
MaxSpareThreads     75 
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild  0
</IfModule>

# BeOS MPM
# StartThreads: how many threads do we initially spawn?
# MaxClients:   max number of threads we can have (1 thread == 1 client)
# MaxRequestsPerThread: maximum number of requests each thread will process
<IfModule beos.c>
StartThreads               10
MaxClients                 50
MaxRequestsPerThread       10000
</IfModule>    

# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxRequestsPerChild: Maximum  number of requests a thread serves. It is 
#                      recommended that the default value of 0 be set for this
#                      directive on NetWare.  This will allow the thread to 
#                      continue to service requests indefinitely.                          
<IfModule mpm_netware.c>
ThreadStackSize      65536
StartThreads           250
MinSpareThreads         25
MaxSpareThreads        250
MaxThreads            1000
MaxRequestsPerChild      0
MaxMemFree             100
</IfModule>

# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process, 
#                  to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxRequestsPerChild: Maximum number of connections per server process
<IfModule mpmt_os2.c>
StartServers           2
MinSpareThreads        5
MaxSpareThreads       10
MaxRequestsPerChild    0
</IfModule>


And this is my top after upgrading:


Code:
 10:26:33  up  1:18,  4 users,  load average: 0.27, 0.21, 0.25
101 processes: 98 sleeping, 3 running, 0 zombie, 0 stopped
CPU0 states:  28.3% user   1.3% system    0.0% nice   0.0% iowait  69.2% idle
CPU1 states:  17.2% user   3.4% system    0.0% nice   0.0% iowait  78.2% idle
Mem:  1030320k av,  770376k used,  259944k free,       0k shrd,   23448k buff
                    682748k actv,   27464k in_d,   12564k in_c
Swap: 1044216k av,   12508k used, 1031708k free                  431592k cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
 3083 nobody    15   0 28336  27M  2824 S    30.9  2.7   0:05   0 httpd
 3185 nobody    16   0 18388  17M  2760 S     8.5  1.7   0:00   1 httpd
 3122 nobody    16   0 27512  26M  2748 R     4.3  2.6   0:03   0 httpd
 3117 mysql     15   0 16820 9800  2648 S     3.1  0.9   0:00   1 mysqld
 3215 nobody    16   0 18684  18M  2720 R     2.5  1.8   0:01   1 httpd
 1764 app       15   0 58656  57M 12060 S     1.1  5.6   0:35   0 jsvc
    9 root      15   0     0    0     0 SW    0.5  0.0   0:03   0 kscand/Normal
 3223 mysql     20   0 16820 9800  2648 S     0.3  0.9   0:00   0 mysqld
 3183 root      15   0  1140 1140   900 R     0.1  0.1   0:00   1 top
    1 root      15   0   104   84    56 S     0.0  0.0   0:04   1 init
    2 root      RT   0     0    0     0 SW    0.0  0.0   0:00   0 migration/0
    3 root      RT   0     0    0     0 SW    0.0  0.0   0:00   1 migration/1
    4 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 keventd
and cat /proc/meminfo

Code:
        total:    used:    free:  shared: buffers:  cached:
Mem:  1055047680 816025600 239022080        0 24104960 455155712
Swap: 1069277184 12808192 1056468992
MemTotal:      1030320 kB
MemFree:        233420 kB
MemShared:           0 kB
Buffers:         23540 kB
Cached:         431980 kB
SwapCached:      12508 kB
Active:         709016 kB
ActiveAnon:     304256 kB
ActiveCache:    404760 kB
Inact_dirty:     27480 kB
Inact_laundry:   19592 kB
Inact_clean:     12596 kB
Inact_target:   153736 kB
HighTotal:      131052 kB
HighFree:         1024 kB
LowTotal:       899268 kB
LowFree:        232396 kB
SwapTotal:     1044216 kB
SwapFree:      1031708 kB
 
Old 04-23-2006, 11:44 PM   #6
CelticSoul
LQ Newbie
 
Registered: Oct 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Noone bothers to reply any more?
Please help, I'm really stuck now.
 
Old 04-24-2006, 01:27 PM   #7
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by CelticSoul
For MPM, I'm not sure which one I'm using, cause I can't run "server-info" thingy.
Running "/path/to/httpd -V" will tell you which MPM is configured.

Have you looked in error_log to see what errors get logged if/when Apache crashes? Can you post any errors you get here?

Peace...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql and httpd memory load is HIGH !!! Pariah Linux - General 3 10-31-2009 12:56 PM
Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/local/lib/libaprutil-0.so. bijuhpd Linux - Newbie 1 10-30-2005 05:07 PM
service httpd status, results in httpd dead but subsys locked squadja Red Hat 2 09-11-2004 10:31 PM
Httpd and memory problem spede Linux - General 1 09-28-2003 08:09 AM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 10:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration