2

I'm trying to understand more how Apache works. I used top -c to analyze Apache processes. On two of my servers I constantly have:

httpd -k restart -DSSL 
httpd -k restart -DSSL 
httpd -k restart -DSSL 
httpd -k restart -DSSL 
httpd -k restart -DSSL 

From what I understand this restarts Apache. Why are there so many processes restarting Apache. What I expected was:

httpd -DSSL 

Can someone explain this to a newbie admin? The sites are all running fine, should I still worry about it?

Thank you Oliver

2
  • For clarification instead of httpd -k start -DSSL I ONLY have restart commands. Why is that? Exploit?
    – mashup
    Sep 14, 2011 at 2:58
  • Could you please edit your post to append the output of ps auxfw | grep httpd?
    – quanta
    Sep 14, 2011 at 3:18

1 Answer 1

1

If you use the rather excellent htop utility and arrange in tree view, you can see that those are child processes of Apache. In fact, looking at a box I admin just now, all of my Apache processes (parent and children) have that path.

From the Apache manual:

The second method of signaling the httpd processes is to use the -k command line options: stop, restart, graceful and graceful-stop, as described below. These are arguments to the httpd binary, but we recommend that you send them using the apachectl control script, which will pass them through to httpd.

-DSSL just tells Apache to start with SSL support.

If you have many child processes constantly spawned this is to accommodate whatever you have set in your httpd.conf -- or one of the sub-httpd confs depending on your setup. For example, on my VPS I use the MPM prefork add-in so my main config is handled in httpd-mpm.conf. In there, my server config is thus:

<IfModule mpm_prefork_module>
     StartServers 1
     MinSpareServers 1
     MaxSpareServers 5
     ServerLimit 4
     MaxClients 7
     MaxRequestsPerChild 10
</IfModule>

This is on a virtualised machine being presented with a dual CPU, 1 GB RAM, 1 GB swap, plenty of diskspace. Linux reports as an Intel Xeon X3360 @ 2.83 GHz.

These are comparatively low values, but the server is already busy handling mail, spam filtering, DNS and MySQL (which is a HUGE resource hog and doesn't enjoy being hosted in VMs, even when tuned). I'd rather provide longer pageload times than end up inadvertently DDoSing myself because I'm being greedy with my connection limits.

There's so much reading you need to do to fully understand the impact of child processes, memory requirements, what's actually good or bad with regards to swap usage / physical RAM usage / disk I/O / high or low Apache limits... And to make matters worse, many people will say many contrasting things, the only way to truly know what works for you is to induce constant moderate load on the server and watch how it performs. Protip: if your SSH terminal's getting sluggish under load, it's not good enough.

Some load testing / benchmarking links to read:

tl;dr: if your server is serving pages quickly enough and not impacting on regular performance, don't touch anything. :-) If you do touch anything, always backup your Apache configs first. Tuning MySQL is likely going to cause you far more headaches in the future ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .