LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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
 
Search this Thread
Old 08-29-2002, 07:29 PM   #1
SplashHost.com
LQ Newbie
 
Registered: Aug 2002
Posts: 5

Rep: Reputation: 0
Limiting the total amount of memory usage by apache.


Does anyone know how to limit the total amount of memory usage by apache? Ive got a problem with my servers crasing and i believe its down to apache consuming all the memory. I have tried using rlimitmem but that doesnt seem to have any affect.
 
Old 08-30-2002, 04:27 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
Limit the number of child process requests, spare servers and max servers

Also look at the keepalive time settings, maybe make them more agressive.

Keep an eye on the log files for access to dynamic content, cgi, php etc
make efforts to speed the scripts up...

Regards,
Peter
 
Old 08-30-2002, 04:38 AM   #3
FredrikN
Member
 
Registered: Nov 2001
Location: Sweden
Distribution: GNU/Linux since -97
Posts: 149

Rep: Reputation: 15
What Dist do you use ?

In debian you can edit these limits in the /etc/security/limits.conf
for user nobody, if you are running apache as nobody.

If you dont have the limits.conf file you can modify the .bashrc file with ulimit

Look in the man ulimit for more info
 
Old 08-30-2002, 06:38 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,564
Blog Entries: 54

Rep: Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927
Re: Limiting the total amount of memory usage by apache.

Ive got a problem with my servers crasing and i believe its down to apache consuming all the memory.

Please first try to make pretty certain you're looking at the right area by gathering data about memory usage. That's better that vague guesstimating (and not giving any stats and system info as well). Try running sar/atsar-like commands to give you data about memory/cpu/network/http counters. I prefer using "atop" (freshmeat) for periodic memory reports.

When you're sure data supports Apache *is* the culprit look at your hardware and see if it needs expanding in the cpu/mem field, Linux VM settings, like FredrikN says, the PAM per-user settings. Then tweak your /proc and Apache settings like peter_robb says.

// Moderator note: I'm grafting this to /General, this is about measuring system/application performance and system configuration.

Last edited by unSpawn; 08-30-2002 at 06:39 AM.
 
Old 08-30-2002, 07:51 AM   #5
SplashHost.com
LQ Newbie
 
Registered: Aug 2002
Posts: 5

Original Poster
Rep: Reputation: 0
Apache isnt using too much memory 99.9% of the time so its not that my system isnt capable of handling the load. I believe there is a malicous script on the system. I am using Red Hat Linux 7.2 and have allrady tried using /etc/security/limits.conf to limit the user nobody but with no sucess
 
Old 08-30-2002, 09:22 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,564
Blog Entries: 54

Rep: Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927Reputation: 2927
Not to be too harsh, but your reply is contradicting your original post. Again, if you're guesstimating (as in I believe, I think, I assume), try *pinpoint* what the problem is.
If you made sure there is a "malicious" script then trying to work ulimits is trying to mend the problem by the *symptoms*, not the *cause*!

You should inspect your scripts instead, ofcourse....
 
Old 08-30-2002, 10:50 AM   #7
SplashHost.com
LQ Newbie
 
Registered: Aug 2002
Posts: 5

Original Poster
Rep: Reputation: 0
I have 9 servers with about 500 sites on each server so its not possible to just look at the scripts and see whats causing it. I can tell from /var/log/messages thtas its httpd processes that are taking up the memory when the server crashes.
 
Old 08-30-2002, 10:53 AM   #8
SplashHost.com
LQ Newbie
 
Registered: Aug 2002
Posts: 5

Original Poster
Rep: Reputation: 0
When the server crashes nothing will work so its not possible to see what sites are causing it.
 
Old 08-30-2002, 10:56 AM   #9
SplashHost.com
LQ Newbie
 
Registered: Aug 2002
Posts: 5

Original Poster
Rep: Reputation: 0
I have actually seen in top once that it was httpd processes consuming the memory, but i wasnt able to determine what site it was from. I need to be able to stop them crashing the server so i can determine what script is causing it.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
memory usage (apache related?) stonecrest Linux - General 3 08-10-2005 06:52 AM
Limiting the amount of bandwidth Apache Uses wenberg Linux - Software 0 02-07-2005 12:39 PM
Apache, PHP, Mysql memory usage MikeyCarter Linux - Software 0 09-24-2003 01:37 PM
shared Memory versus the total amount of RAM on the server ashley75 Linux - General 1 08-25-2003 12:21 PM
limiting cpu and memory usage by user process amitkush Linux - Security 2 07-04-2003 01:21 AM


All times are GMT -5. The time now is 06:08 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