LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 11-06-2004, 02:11 PM   #1
stonecrest
Member
 
Registered: Sep 2004
Distribution: Arch :D
Posts: 66

Rep: Reputation: 15
memory usage (apache related?)


I have a dedicated web server running apach 2, php4, and mysql4 (celeron 1.3, 1gb of ram). When I first boot up the system and users start browsing the website, my memory usage is about 200-300mb. After a few hours though, with the same number of users browsing the website, the memory usage just keeps going up and up until the server crashes. I look at top, but it doesn't make sense to me because the memory usage by the processes doesn't add up to anywhere near what it says is being used.

For example, here is the top command sorted by memory usage:

Code:
 2:03pm  up 12:28,  1 user,  load average: 1.00, 1.00, 0.96
57 processes: 56 sleeping, 1 running, 0 zombie, 0 stopped
CPU states:  0.0% user,  0.0% system,  0.0% nice, 100.0% idle
Mem:  1023128K av, 1010028K used,   13100K free,       0K shrd,   71408K buff
Swap: 1020116K av,     356K used, 1019760K free                  883832K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
18178 apache     9   0  5296 5296  2280 S     0.0  0.5   0:01 httpd
18887 apache     9   0  5152 5152  2272 S     0.0  0.5   0:00 httpd
19014 apache     9   0  4928 4928  2252 S     0.0  0.4   0:00 httpd
19057 apache     9   0  4456 4456  2252 S     0.0  0.4   0:00 httpd
18624 apache     9   0  4348 4348  2248 S     0.0  0.4   0:00 httpd
19019 apache     9   0  4340 4340  2256 S     0.0  0.4   0:00 httpd
19780 apache     9   0  3800 3800  2104 S     0.0  0.3   0:00 httpd
19784 apache    10   0  3684 3684  2100 S     0.0  0.3   0:00 httpd
19752 apache     9   0  3452 3452  2108 S     0.0  0.3   0:00 httpd
19798 apache     9   0  3444 3444  2100 S     0.0  0.3   0:00 httpd
19788 apache    13   0  3440 3440  2104 S     0.0  0.3   0:00 httpd
19813 apache    13   0  3396 3396  2104 S     0.0  0.3   0:00 httpd
19825 apache     9   0  3348 3348  2064 S     0.0  0.3   0:00 httpd
19774 apache    13   0  3228 3228  2104 S     0.0  0.3   0:00 httpd
19824 apache     9   0  3052 3052  2060 S     0.0  0.2   0:00 httpd
19828 apache     9   0  2984 2984  1976 S     0.0  0.2   0:00 httpd
 2212 root       8   0  2044 2044  1188 S     0.0  0.1   0:00 httpd
19829 root      11   0  1672 1616  1280 S     0.0  0.1   0:00 sshd
19830 root      10   0  1308 1308   984 S     0.0  0.1   0:00 bash
 1027 root       9   0  1088 1088   672 S     0.0  0.1   0:00 urchinwebd
 1028 urchin     9   0  1084 1084   660 S     0.0  0.1   0:00 urchinwebd
 1029 urchin     9   0  1084 1084   660 S     0.0  0.1   0:00 urchinwebd
 1030 urchin     9   0  1084 1084   660 S     0.0  0.1   0:00 urchinwebd
 1031 urchin     9   0  1084 1084   660 S     0.0  0.1   0:00 urchinwebd
 1032 urchin     9   0  1084 1084   660 S     0.0  0.1   0:00 urchinwebd
  893 root       8   0  1032 1032   516 S     0.0  0.1   0:00 sendmail
19920 root      16   0  1008 1008   812 R     0.0  0.0   0:00 top
  817 root       9   0   436  328   224 S     0.0  0.0   0:01 sshd
 1034 urchin     9   0   272  272   188 S     0.0  0.0   0:00 urchind
  852 root       9   0   272  260    96 S     0.0  0.0   0:00 xinetd
  626 root       9   0   256  248   196 S     0.0  0.0   0:00 klogd
  924 root       9   0   172  172    92 S     0.0  0.0   0:00 crond
  621 root       9   0   196  148   112 S     0.0  0.0   0:00 syslogd
    1 root       6   0   116   84    48 S     0.0  0.0   0:04 init
  973 root       9   0    76   76     8 S     0.0  0.0   0:00 rhnsd
 1042 root       9   0    76   76    12 S     0.0  0.0   0:00 agetty
It says that 1gb of memory is being used but look at the memory for the actual processes - they add up to like 100mb! What is causing all the other memory usage? What is going on?

Thanks in advance..
Scott
 
Old 11-06-2004, 02:41 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 194Reputation: 194
Memory is cached and used efficiently in Linux. This is normal, don't start worrying until swap starts getting used heavily. Also, this is asked all the time about memory in Linux, you should try searching for more detailed explanations.. I've answered it so many times myself, I don't feel like going into those details myself.

free <-- the command is your friend for memory.
 
Old 04-11-2005, 02:13 AM   #3
pksden
LQ Newbie
 
Registered: Apr 2005
Distribution: RHEL3.0
Posts: 2

Rep: Reputation: 0
apache eat memory like catterpillar

i have same problem, and is trying few solutions mentioned in various places

one such article is:
http://www.linuxquestions.org/questi...icle&artid=312

There are many other articles telling to change Maxrequestsperchild to 20-25 and in httpd.conf

I have to still try them though initial tries did not help.

Let me know if you tried any solution successfully.

My problem is specially due to dynamic content served with mysql . apache processes start wiht 39MB keep growing and then hand the server. Mysql processes also eat a lot. I had 380MB ram before and increased to 1GB and still its happening.

I think this problem is common and there should be tested solutions instead of trials suggested in most articles.
 
Old 08-10-2005, 05:52 AM   #4
matthewchin
Member
 
Registered: Jun 2003
Posts: 40

Rep: Reputation: 15
I appreciated that RAM should be used but not FREE !

My case is similar installed FC3, the free memory is little (mostly) out of 512MB.

However, I found my cache is sometimes not much (32MB e.g.).

so I check the ps and seen most memory is being used by around (usually) 20 httpd (each 6% total mem) processes.....

Questions:
1) is this also normal ?
2) why httpd not free up mem (the memory limit is 16M shown in phpinfo.php)
3) if not normal, how to config the solution for this ?
(meant I want each httpd use less memory and maximize them (allow more httpd processes)) ?
(but not just keep mem free).

Thanks for opinions.

Matthew (Hong Kong)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 05:55 AM
Apache, PHP, Mysql memory usage MikeyCarter Linux - Software 0 09-24-2003 12:37 PM
Limiting the total amount of memory usage by apache. SplashHost.com Linux - General 8 08-30-2002 09:56 AM


All times are GMT -5. The time now is 08:09 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration