Limiting the total amount of memory usage by apache.
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
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....
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.