Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache servers using all memory/cpu.

Status
Not open for further replies.

Zyxian

Technical User
Apr 29, 2002
42
US
Hello.
My problem:
Serveral times a day my RedHat servers CPU and Memory is totaly used up by a run away apache server. When I run top there could be 1, 2 or more servers taking up all the resources. I will either kill them off in top or do a restart of htttpd.
Questions:
1) Is there a way to see what that server is proccessing? I think it goes bonkers when a request comes in from a virus looking for a NT directory - still looking in my logs to confirm this but if I could see what the server is doing would be easier.
2)(And the important one) How do I limit the amount of memory and cpu usage the apache servers use?
I know you can limit the child processes with the RLimitCPU/RLimitMemory directives but I can't find anything about the StartServers other than the number to start.
Thank you.
Zyxian
 
Thank your for repling wullie.

MaxClient is the number of people that can connect at one time. I am not having a problem with connections.

My problem is the servers that start when httpd starts get a request of some sort that makes them keep taking both memeory and cpu time. Zyxian
 
Hi mate,

This is a problem I have never had so I am trying to work out a solution based on what you have told me and what I already know about Apache..

If you read the httpd then you should see the following lines...

#
# Limit on total number of servers running, i.e., limit on the number
# of clients who can simultaneously connect --- if this limit is ever
# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
# It is intended mainly as a brake to keep a runaway server from taking
# the system with it as it spirals down...

#
MaxClients 150

Unless you can supply more details of what is actually causing this then I am not sure that there is much more that we could do..

Hope this helps Wullie

 
Wullie,

That is part of the problem. I do not know what is causing it. That is reason for my question 1. Is there a way to see what the server is processing/esponding to that causes it to use up all the memory and cpu time? If I can see the cause, I'll have a better chance of finding the solution. Zyxian
 
Hi

O don't now if this function is in RedHat, but in Mandrake 8.2 there is a fuction that can cacth runaway processes. In that you can specify a limit of fx. 20 % cpu usage, and if the process excedds that it gets killed.

Unfortunly i cant remember the name of the function. I mean i fund it by right clicking on the bar at the bottom and added the function to it.

I'm kind of a linux nOOb so dont ask to many questions. It is not sure i will be able to answer.
 
Wullie,

I set the log level to debug but since there isn't an error nothing is getting reported.

It just happened again and the closest thing to the time the process started was a request for root.exe (virus attack).

I'm going to lookup how to do the rewrite directive and see if that fixes it.

Mianus,

I've been looking for that command/switch but haven't found it yet. Thanks. Zyxian
 
If i don't remember wrong it was under KDE i found it.

Which windowmanager do you use???
 
Mianus,

None. I'm trying to learn the command line first before I start using a gui. I figure I will have a better understanding of Linux that way. Zyxian
 
Well I found the answer to my 1st question.

I enabled mod_status and ExtendedStatus. Now I can see what request each server is handling.

Now watch me never get a run away server again... LOL Zyxian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top