The following version of Apache is used. (MPM : event)
httpd -V
Server version: Apache/2.4.37 (Red Hat Enterprise Linux)
Server built: Jun 15 2022 08:27:14
Server's Module Magic Number: xxxxxxxx:xx
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)
The settings are as follows.
<IfModule mpm_event_module>
StartServers 3
ServerLimit 3
ThreadsPerChild 25
MaxRequestWorkers 75
</IfModule>
I understand the relationship between ServerLimit, ThreadsPerChild and MaxRequestWorkers. (ThreadsPerChild * ServerLimit = MaxRequestWorkers)
In the above configuration, I expect to run 1 parent process + 3 child processes for a total of 4 processes.
However, the following occurs For some reason, parent process 1 + child process 5 is launched.
ps -ylC httpd
S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMD
S 0 1234082 1 1 80 0 62164 85197 - ? 00:00:00 httpd # Parent
S 48 1234083 1234082 0 80 0 55936 88443 - ? 00:00:00 httpd # Child1
S 48 1234084 1234082 0 80 0 55860 88787 - ? 00:00:00 httpd # Child2
S 48 1234085 1234082 0 80 0 63784 697650 - ? 00:00:00 httpd # Child3
S 48 1234086 1234082 0 80 0 61732 648482 - ? 00:00:00 httpd # Child4
S 48 1234087 1234082 0 80 0 65812 648482 - ? 00:00:00 httpd # Child5
When loaded by sending a large number of Http requests, RSS increases only for Child 3, 4, and 5, with little change for Child 1 and 2.
From this, I assume that Child3, 4, and 5 are the normal processes that we expect to see, and Child1 and 2 are processes that are being created for some special reason.
I have another question. Regarding the number of threads in each child process, I would expect it to be 25thread.
However, it looks like this
ps aux -L | grep httpd | grep -v grep | perl -awln -F'\s+' -e 'print "$F[0] $F[1]"' | sort | uniq -c
1 root 1234082 # Parent
1 apache 1234083 # Child1
1 apache 1234084 # Child2
81 apache 1234085 # Child3
65 apache 1234086 # Child4
65 apache 1234087 # Child5
For some reason, Child3, 4, and 5 exceed the ThreadsPerChild value of 25 and reach numbers such as 65 and 81.
(The anomaly of Child1 and Child2 is also apparent here.)
Question 1 : What are the Child1 and Child2 processes doing? Why do they start extra?
Question 2 : Why do Child3, 4, and 5 exceed ThreadsPerChild and have large thread counts?
As an additional note, similar results are obtained using the following settings.
<IfModule mpm_event_module>
StartServers 4
ServerLimit 4
ThreadsPerChild 25
MaxRequestWorkers 100
</IfModule>
Four child processes that are considered normal and two child processes that are considered abnormal are launched.
ps -ylC httpd
S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMD
S 0 1235661 1 2 80 0 62540 85203 - ? 00:00:00 httpd
S 48 1235663 1235661 0 80 0 56108 88443 - ? 00:00:00 httpd
S 48 1235664 1235661 0 80 0 56176 88786 - ? 00:00:00 httpd
S 48 1235665 1235661 0 80 0 66036 697656 - ? 00:00:00 httpd
S 48 1235666 1235661 0 80 0 63992 648488 - ? 00:00:00 httpd
S 48 1235667 1235661 0 80 0 63992 664872 - ? 00:00:00 httpd
S 48 1235668 1235661 0 80 0 63968 664872 - ? 00:00:00 httpd
ps aux -L | grep httpd | grep -v grep | perl -awln -F'\s+' -e 'print "$F[0] $F[1]"' | sort | uniq -c
1 root 1235661
1 apache 1235663
1 apache 1235664
81 apache 1235665
65 apache 1235666
65 apache 1235667
65 apache 1235668
Thanks in advance.