我们正在使用apache版本4。我们的服务器正在获得8000个并发连接。以下是我们的工作程序模块配置
<IfModule mpm_worker_module>
ServerLimit 16
StartServers 20
MaxClients 8000
MinSpareThreads 512
MaxSpareThreads 1024
ThreadsPerChild 64
MaxRequestWorkers 1024
MaxConnectionsPerChild 10000
</IfModule>
使用上述配置,我们在apache服务器error.log中遇到以下错误
[Mon Nov 12 12:38:58.838952 2018] [mpm_winnt:notice] [pid 3304:tid 480] AH00418: Parent: Created child process 6416
[Mon Nov 12 12:38:59.745235 2018] [jk:warn] [pid 6416:tid 364] No JkLogFile defined in httpd.conf. Using default C:/Apache/logs/mod_jk.log
[Mon Nov 12 12:38:59.917109 2018] [jk:warn] [pid 6416:tid 364] No JkLogFile defined in httpd.conf. Using default C:/Apache/logs/mod_jk.log
[Mon Nov 12 12:38:59.932736 2018] [mpm_winnt:notice] Child: Starting 250 worker threads.
[Mon Nov 12 12:39:06.471238 2018] [mpm_winnt:error] Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
在那之后,我们将ThreadsPerChild更改为100,在那之后,我们得到了以下错误
[Mon Nov 12 12:47:35.837220 2018] [core:notice] [pid 3304:tid 480] AH00094: Command line: 'C:\\Apache\\bin\\httpd.exe -d C:/ApacheWeb'
[Mon Nov 12 12:47:35.837220 2018] [mpm_winnt:notice] [pid 3304:tid 480] AH00418: Parent: Created child process 9188
[Mon Nov 12 12:47:36.821579 2018] [jk:warn] [pid 9188:tid 368] No JkLogFile defined in httpd.conf. Using default C:/ApacheWeb/logs/mod_jk.log
[Mon Nov 12 12:47:37.102834 2018] [jk:warn] [pid 9188:tid 368] No JkLogFile defined in httpd.conf. Using default C:/ApacheWeb/logs/mod_jk.log
[Mon Nov 12 12:47:37.118481 2018] [mpm_winnt:notice] [pid 9188:tid 368] AH00354: Child: Starting 250 worker threads.
[Mon Nov 12 12:48:02.464408 2018] [mpm_winnt:error] [pid 9188:tid 6488] AH00326: Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
[Mon Nov 12 12:48:10.216397 2018] [mpm_winnt:notice] [pid 7888:tid 364] AH00362: Child: Waiting 30 more seconds for 29 worker threads to finish.
[Mon Nov 12 12:48:43.069214 2018] [mpm_winnt:notice] [pid 7888:tid 364] AH00362: Child: Waiting 0 more seconds for 7 worker threads to finish.
[Mon Nov 12 12:48:43.178567 2018] [mpm_winnt:notice] [pid 7888:tid 364] AH00363: Child: Terminating 7 threads that failed to exit.
[Mon Nov 12 12:48:43.178567 2018] [mpm_winnt:notice] [pid 7888:tid 364] AH00364: Child: All worker threads have exited.
[Mon Nov 12 12:49:37.253636 2018] [mpm_winnt:notice] [pid 9188:tid 368] AH00363: Child: Terminating 243 threads that failed to exit.
[Mon Nov 12 12:49:37.253636 2018] [mpm_winnt:notice] [pid 9188:tid 368] AH00364: Child: All worker threads have exited.
之后,我们使用以下配置
<IfModule mpm_worker_module>
ServerLimit 125
StartServers 20
MinSpareThreads 512
MaxSpareThreads 1024
ThreadsPerChild 64
MaxRequestWorkers 8000
MaxConnectionsPerChild 10000
</IfModule>
现在我们低于日志
[Mon Nov 12 14:29:08.996704 2018] [core:notice] [pid 7124:tid 476] AH00094: Command line: 'C:\\Apache\\bin\\httpd.exe -d C:/Apache'
[Mon Nov 12 14:29:08.996704 2018] [mpm_winnt:notice] [pid 7124:tid 476] AH00418: Parent: Created child process 8708
[Mon Nov 12 14:29:09.981085 2018] [jk:warn] [pid 8708:tid 372] No JkLogFile defined in httpd.conf. Using default C:/Apache/logs/mod_jk.log
[Mon Nov 12 14:29:10.184213 2018] [jk:warn] [pid 8708:tid 372] No JkLogFile defined in httpd.conf. Using default C:/Apache/logs/mod_jk.log
[Mon Nov 12 14:29:10.199837 2018] [mpm_winnt:notice] [pid 8708:tid 372] AH00354: Child: Starting 250 worker threads.
[Mon Nov 12 14:29:43.361221 2018] [mpm_winnt:notice] [pid 5988:tid 372] AH00362: Child: Waiting 30 more seconds for 11 worker threads to finish.
[Mon Nov 12 14:30:00.549960 2018] [mpm_winnt:notice] [pid 5988:tid 372] AH00364: Child: All worker threads have exited.
[Mon Nov 12 14:31:33.959999 2018] [mpm_winnt:notice] [pid 8708:tid 372] AH00358: Child: Process exiting because it reached MaxConnectionsPerChild. Signaling the parent to restart a new child process.
[Mon Nov 12 14:31:33.959999 2018] [mpm_winnt:notice] [pid 7124:tid 476] AH00424: Parent: Received restart signal -- Restarting the server.
我们经常得到
Child: Process exiting because it reached MaxConnectionsPerChild. Signaling the parent to restart a new child process.
如何解决此错误,将不胜感激!
答案 0 :(得分:0)
您正在使用Windows实现模块(mpm_winnt
)而不是mpm_worker_module
。尝试找到以下部分:
<IfModule mpm_winnt_module>
ThreadsPerChild 1000
MaxConnectionsPerChild 20000
AcceptFilter http None
AcceptFilter https None
</IfModule>
并修改ThreadsPerChild
参数。