Forum Moderators: phranque

Message Too Old, No Replies

MaxRequestWorkers warning

value in log doesn't match value in httpd.conf

         

Megunticook

10:53 am on Jun 22, 2019 (gmt 0)

5+ Year Member



I'm on Apache 2.4.

In my server error log I see this:

[mpm_event:warn] [pid 3030:tid 139663588325568] AH00514: MaxRequestWorkers of 120 is not an integer multiple of ThreadsPerChild of 25, decreasing to nearest multiple 100


But in httpd.conf I have this:
#configure MPM event module
# Optimized settings for AWS EC2 t2.medium Server
<IfModule mpm_event_module>
ServerLimit 500
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 500
MaxConnectionsPerChild 1000
</IfModule>


How can this be? I've searched httpd.conf for an accidental duplicate setting, there is none. I've restarted the server. Where is that MaxRequestWorkers 120 setting coming from? Is there another location to set this that I don't know about?

Thanks--I feel like I'm in the Twilight Zone here...

Megunticook

11:05 am on Jun 22, 2019 (gmt 0)

5+ Year Member



This is on Amazon Linu 2, by the way. I also checked /etc/httpd/conf.modules.d/00-mpm.conf, but the only uncommented line is:

LoadModule mpm_event_module modules/mod_mpm_event.so

lucy24

3:25 pm on Jun 22, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<IfModule mpm_event_module>
Is this the right name for the mod that covers these directives? (And, for that matter, since it's your own server why is the IfModule even needed?) Looking it up, I find it liisted as mpm_common. Are other directives within the IfModule envelope getting recognized?

iamlost

6:18 pm on Jun 22, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



OK, caveat emptor :) as I'm on a dedicated server and not a cloud setup.

When making changes MPM settings require a full HARD stop and start not simply a restart.
Did you do so?

Megunticook

8:54 pm on Jun 22, 2019 (gmt 0)

5+ Year Member



I thought that was the right name but maybe I have it wrong.

I rebooted the server entirely. Do I actually need to stop php-mpm on the command line, then start again?

iamlost

9:33 pm on Jun 22, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not certain that the below applies to you or to a cloud instance install.
Change to either ServerLimit or ThreadLimit requires fully stopping the server itself and then restarting.

Apache MPM worker [httpd.apache.org]

Two directives set hard limits on the number of active child processes and the number of server threads in a child process, and can only be changed by fully stopping the server and then starting it again. ServerLimit is a hard limit on the number of active child processes, and must be greater than or equal to the MaxRequestWorkers directive divided by the ThreadsPerChild directive. ThreadLimit is a hard limit of the number of server threads, and must be greater than or equal to the ThreadsPerChild directive.

phranque

10:39 pm on Jun 22, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



rebooting the server will essentially achieve a full stop and fresh start.

Megunticook

8:57 pm on Jun 25, 2019 (gmt 0)

5+ Year Member



OK, so it's not a server restart thing. Is Apache looking elsewhere for those values or using some default values?

lucy24

9:22 pm on Jun 25, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wait, stop, rewind. At the beginning you said
But in httpd.conf I have this
I took this to mean that these were values you'd entered yourself, but did you mean that this is part of the default config file that you haven't changed?

I would dearly like to know where it’s getting 120, since it definitely isn’t a default value.

After further poring over docs I do see where the config file got _event_ from. Whew. Docs also say [httpd.apache.org]:

For threaded and hybrid servers (e.g. event or worker) MaxRequestWorkers restricts the total number of threads that will be available to serve clients. For hybrid MPMs the default value is 16 (ServerLimit) multiplied by the value of 25 (ThreadsPerChild). Therefore, to increase MaxRequestWorkers to a value that requires more than 16 processes, you must also raise ServerLimit.

:: counting on fingers ::

Wouldn't 16*25 be 400?

:: wandering off to look for abacus ::

phranque

10:19 pm on Jun 25, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



perhaps there is a hardcoded value of 120 in the apache module that is overriding the configured value.

Megunticook

10:11 pm on Jun 26, 2019 (gmt 0)

5+ Year Member



How would I check if there's a "hardcoded value of 120 in the Apache module"?

lucy24

11:06 pm on Jun 26, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, that's the part we're all trying to figure out, because absolutely nothing in the docs says anything about 120--and as they themselves say, Value A is supposed to be an exact multiple of Value B, while 120 isn't a multiple of anything.* If all the other values in the <IfModule> envelope you quoted at the beginning are being recognized, then it really seems as if MaxRequestWorkers is getting set again somewhere else.

Can I assume you've done a whole-text search of your config file to verify that this is the only occurrence of “MaxRequestWorkers” ?

I'm especially puzzled by the fact that ServerLimit and MaxRequestWorkers are set to the same number. Docs say, terrifyingly, **
Special care must be taken when using this directive. If ServerLimit is set to a value much higher than necessary, extra, unused shared memory will be allocated. If both ServerLimit and MaxRequestWorkers are set to values higher than the system can handle, Apache httpd may not start or the system may become unstable.
I would prefer not to think that “unstable” here means “the server starts making up numbers out of the clear blue sky”.


* Well, except 2, 3 and 5, and assorted multiples thereof. But you know what I mean.
** I am easily frightened by Apache docs.

phranque

11:25 pm on Jun 26, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



How would I check if there's a "hardcoded value of 120 in the Apache module"?

if i knew i'd have said how. =8)

do you have MaxClients defined anywhere?

Megunticook

4:19 am on Jul 1, 2019 (gmt 0)

5+ Year Member



No...that's the old name for MaxRequestWorkers, right? I searched httpd.conf and nothing.

I do have this value in www.conf:

pm.max_children = 40

But still trying to understand how it thinks MaxRequestWorkers is 120...

iamlost

6:52 am on Jul 1, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




No...that's the old name for MaxRequestWorkers, right?

Yes.

MaxRequestWorkers was called MaxClients before version 2.3.13. The old name is still supported.


.....

That '120' has me, as others above, wondering if/where there is something overriding.
<IfModule mpm_event_module>

You shared the above.
Is that the original EC2 code and you just changed the numbers?
The reason I ask is that there are three (3) MPM choices:
* event (what you are checking with that If statement)
* prefork
* worker
If your MPM is not 'event' your changes would have no effect.
You can check which MPM is being used by
httpd -V


........

pm.max_children

is a PHP-FPM config, and usually a calculation of [ total RAM dedicated to web server / max child process size ]
Off hand... shouldn't affect an MPM config error message.

Megunticook

12:45 pm on Jul 8, 2019 (gmt 0)

5+ Year Member



Yes, it's event.
Server version: Apache/2.4.39 ()
Server built: Apr 4 2019 18:09:28
Server's Module Magic Number: 20120211:84
Server loaded: APR 1.6.3, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"


Where else can you set MaxRequestWorkers besides httpd.conf?

Dimitri

1:27 pm on Jul 8, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Where else can you set MaxRequestWorkers besides httpd.conf?

You can always try to search for all files including MaxRequestWorkers.

grep -rnw '/some/path/' -e 'MaxRequestWorkers'

lucy24

4:16 pm on Jul 8, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Where else can you set MaxRequestWorkers besides httpd.conf?
Nowhere--but there's a dreaded technicality in the form of Includes, so you have to check those too.

Megunticook

11:54 am on Jul 13, 2019 (gmt 0)

5+ Year Member



I tried a search like Dimitri suggested:

sudo grep -rnw '/etc' -e 'MaxRequestWorkers'

and all it found was the one setting I have in httpd.conf

/etc/httpd/conf/httpd.conf:67: MaxRequestWorkers 500

what in the world is going on here?

Dimitri

1:27 pm on Jul 13, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



I no longer use Apache since so long, that I do not really remember things, but, is it possible that, for some reasons, Apache is not parsing the block where your MaxRequestWorkers is set? And so, uses the "default" value?

Megunticook

2:56 pm on Jul 17, 2019 (gmt 0)

5+ Year Member



Possible. You know, this is the last site I have on Apache, everything else I've transitioned to NGINX. Maybe it's time to bring this one over as well...

Dimitri

6:05 pm on Jul 17, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



RIP Apache :)

When I left Apache, this was for nginx, and, for some reasons, I feel more comfortable with the configuration , I couldn't explain why, but it looks more natural to me, then later I dropped nginx, for H2O which I love.

Megunticook

3:27 pm on Jul 18, 2019 (gmt 0)

5+ Year Member



H20? Hmmm, that's a new one on me. Will have to check it out.

Dimitri

5:48 pm on Jul 18, 2019 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



H20? Hmmm, that's a new one on me. Will have to check it out.

[h2o.examp1e.net...]
[github.com...]

However, if you use Wordpress or other kind of CMS, forget about it, you will not find all the configuration options needed ... it's certainly possible to do it, but no one as yet published examples.

I use my own CMS, so no problem to make it run with any webserver software.