Re: Running Apache in Single Process Mode for Docker Container?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I hadn't thought of the fact that apache would be architected to use its multiple threads as an internal housekeeping (instead of just to allow parallelization of requests). 

My motivation behind moving the processes to be so low is that I'm trying to explore Apache's suitability for use in a Docker container, in the "Docker way" - minimal processes per containers, that, when the process failed for any reason, the entire container is killed, and you spin up many containers to accommodate that. I think this is the point where I give up, and just spend the time porting this app to nginx. 

Thanks everyone for the help!

On Sun, Oct 25, 2015 at 8:43 PM, Kurtis Rader <krader@xxxxxxxxxxxxx> wrote:
On Sun, Oct 25, 2015 at 8:17 PM, David Aronchick <aronchick@xxxxxxxxx> wrote:
Thanks for all the help all! I dug into the apachectl and realized I was using the config file in sites-enabled, instead of the top level /etc/apache2/apache.conf file. The latter file installs all the modules in /mods-enabled, which is what was missing. (for the curious, I also had to copy all the env vars into a Dockerfile so that the binary executed with the right environment variables set)

So the net is, the following command now starts apache2 correctly:

/usr/sbin/apache2 -DFOREGROUND -DNO_DETACH -f /etc/apache2/apache2.conf

However, it still seems to spin up three threads, which I can't figure out why. Thanks again all!

Threads or processes? In either case why do you care given that the number is so low? If you're using the pre-fork MPM and it's actually starting three processes just tweak the relevant config parameters to meet your needs: http://httpd.apache.org/docs/current/mod/prefork.html. If you're using one of the other threaded MPMs then tweak their settings to meet your needs. I've never attempted to configure apache to be single-threaded (meaning it can only respond to one request at a time) but I would be surprised if that were not possible. However, the result may be two, or even three, processes (pre-fork MPM) or two threads as the absolute minimum. That's because the apache architecture with respect to recognizing and dispatching incoming requests as well as dealing with housekeeping chores may mandate one or more processes or threads for activities other than handling a HTTP request.

--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux