Multiple instances of apache2 running?
I couldn't connect to my server last night while I was at work, so once I got home I checked to see if the server was still on and it was (Had a power outage last week that cause me some issues so I thought that could have been it). I did ps aux | more and saw multiple entries of apache2:
Code:
eric@fate ~ $ ps aux | grep apache2 |
When Apache starts (as you can see its started as root), then drops privs to the named owner (www-data) and starts a given num of listeners, defined in httpd.conf as per the StartServers setting https://httpd.apache.org/docs/2.2/mo...l#startservers.
See also related directives like MaxClients etc on the same page. |
Quote:
Code:
eric@fate ~ $ ps aux | grep apache2 |
Like I said, check the (several) related directives eg MaxCLients; there's also one that dictates how many requests an instance serves before it shuts down.
I'd also check the access_log and error_log to see where the requests are coming from & why. |
my httpd.conf doesn't have anything aside from servername localhost, so default MaxClients should be 256. What I don't understand is 1) Why are child processes not being terminated when someone uses glype proxy, 2) How reducing MaxClients (or any of the other settings) is going to impact anything to me site related. As far as I can imagine, the only thing I can think of is that at a certain point it's just going to stop allowing people to access the site at all because it will enter a queue until the child processes are terminated, which won't happen until I figure out why glype acts this way, manually go in and kill all of those processes myself, or I restart the server. There are only 3 people using the proxy on the website, and according to the glype logs they are solely using it to view content on youtube at this point, so I fail to see why I would have that many remaining child processes going unless it was some issue with glype. I guess I'll just remove glype until I can figure it out. Thanks for your help.
|
But why are you worried? Do you experience some performance problems with this server? If everything is running normally, why do you bother killing processes and restarting the server? I say, let apache do its job, if it needs 256 processes to do it, so be it.
|
I suppose this is why lightweight alternatives exist.
|
Well the main reason is because I suspect it to be part of the reason why I was unable to connect to my server the other day. The modem was alive and when I got home everything appeared to be fine but I couldn't connect still. Checked processes and saw what I've already posted. After restarting, everything worked fine. Went to work and everything was fine until someone came to me saying it was no longer loading content from glype. Checked processes and boom 70 apache processes again. Restart fixed it again. The only thing Ive seen that correlates with the issue is the abundance of child processes that haven't been killed.
Im no expert by any stretch, but I equate it to how you need to delete objects in C++ or they occupy memory indefinitely unless the program exits. |
From what I found on the net, Apache 2 will spawn and keep extra processes ready to service any new clients. How much resources it uses for this ought to be configurable, though I haven't gone through the details. You may also look into MPM worker module http://httpd.apache.org/docs/2.2/mod/worker.html to control thread spawning.
|
Quote:
|
idofxeno, if you know for sure, you won't be serving like a humongous userbase. consider seriously the option of shifting to a lightweight and excellent for smaller sites webserver. nginx and lighttpd come to mind. They are very underrated. First thing to find would be if there are specific dependencies on Apache and how the alternatives can possibly satisfy those.
|
having multiple httpd processes running is perfectly normal behaviour and is nothing to worry about.
|
It is a matter to worry about if your system slows to a crawl and doesn't function even at least as a webserver itself.
|
Quote:
count them as 5 per processor (you could also divide your memory size by the data space used by apache, then subtract 10. If the result is below 10, use 10.) The only reason to allow apache to multi-thread is support concurrent connections. If that overloads the system, the only reasonable thing to do is limit the number threads to what the hardware will support. 256 might be reasonable for my system (8GB with 8 cores), but personally, 10 is enough. |
Quote:
|
Quote:
|
ashwin_cse , I didn't make it clear that I was not just pointing at the large number of processes that get spawned but also how exponentially the resource usage grows with each new child spawned...which may further be compounded by the reasons you gave.
Lots for me to learn from this thread. :) |
All times are GMT -5. The time now is 08:20 PM. |