David Jacob David Jacob - 20 days ago 6
Apache Configuration Question

Apache 2.4 ThreadsPerChild directive not updating number of workers

I'm trying to configure my new Apache 2.4.10 instance on Debian 8.2 after upgrading from Apache 2.2. This time around I'm using the event_mpm module, changing from mpm_worker.

I've set everything up and it all routing seems to be working fine. However I started to see this error in the logs:

[Tue Nov 15 10:05:10.743107 2016] [mpm_event:error] [pid 12345:tid 12345] AH00485: scoreboard is full, not at MaxRequestWorkers


It's not happening all the time, it happens in bulk every few hours. (I realise that there is a bug about this here: https://bz.apache.org/bugzilla/show_bug.cgi?id=53555 . But if I'm reading that correctly it's more about hanging servers, which is not happening to me.)

I don't really understand this error too well, so I review my config. Looking at it I figured I could at least change my ThreadsPerChild value to something higher.

So my config went from this:

<IfModule mpm_event_module>
StartServers 3
MinSpareThreads 150
MaxSpareThreads 500
ThreadLimit 128
ThreadsPerChild 25
MaxRequestWorkers 1200
MaxRequestsPerChild 0




to this:

<IfModule mpm_event_module>
StartServers 3
MinSpareThreads 150
MaxSpareThreads 500
ThreadLimit 128
ThreadsPerChild 75
MaxRequestWorkers 1200
MaxRequestsPerChild 0




I understood that the number of workers is StartServers * ThreadsPerChild (3 * 75 = 225). However when I visit my server-status page, it's still listed as having 75 workers, i.e. my old value of 25 * 3 = 75.

I've reloaded the config, restarted my Apache, and I still see a status like this on the page:

enter image description here

32 requests being processed + 43 idle workers = 75 (3 * 25).
Shouldn't it be 225? Am I missing something?

I definitely have the mpm_event module loaded:

$ apache2ctl -V
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)


So:


  1. Is this error anything to worry about and can I get rid of it by raising my ThreadsPerChild value?

  2. Why does raising my ThreadsPerChild value seemingly do nothing to raise my worker count according to the status page?


Answer
  1. Is this error anything to worry about and can I get rid of it by raising my ThreadsPerChild value?

This error was happening because my scoreboard was getting filled up because I didn't have enough workers available to serve my requests. I thought I was increasing them but I wasn't (see 2) and this is why the recurrence of this error message was puzzling me.

  1. Why does raising my ThreadsPerChild value seemingly do nothing to raise my worker count according to the status page?

My problem was that I had my mpm_event module settings defined in my apache2.conf file, then later on in that file I had this:

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

This was loading the default file:

/etc/apache2/mods-enabled/mpm_event.conf

So both configurations were being loaded and since the "IncludeOptional" declaration was later on in the apache2.conf file, it was loading and overriding the mpm_event settings in apache2.conf with the ones defined in mpm_event.conf. The mpm_event definition in my apache2.conf file was never being used.

I simply removed the mpm_event config in my apache2.conf file and changed the /etc/apache2/conf-available/mpm_event.conf file to my desired settings, restarted the apache server and my status page showed me the new updated configuration.

As a useful side note, I figured this out using the mpm_info module. I activated it, configured it like the docs say in one of my vhosts, then visited the URL. This way I could see all configuration that was being loaded and could immediately see that my mpm_event was coming from a different configuration file.