更改了 mpm-worker 2.4 配置但没有效果
Changed mpm-worker 2.4 config but with no effect
我已将默认配置更改为:
<IfModule worker.c>
ServerLimit 20
StartServers 4
MaxRequestWorkers 600
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 30
MaxConnectionsPerChild 0
</IfModule>
并且在峰值时,使用服务器状态,当它达到 400 个会话时,它似乎仍然没有创建新的工作人员并保持在 400:
BusyWorkers: 400
IdleWorkers: 0
Scoreboard: KKKKCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKRKCKKKKKKCKKRKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKRKKKKKCKKKCKKKKKRKKKCKKKKKKCKKKKKKKKKKKKRCKKCKKKCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCKKKRKKKKKKKRKKKKKKKKKKKKKCKCKKKKKCKKKCKCKKRCRKKKKKKKKKKKKRKKKKKKKKKKKKKKCKKKKCKKKKKRKCCKKKKKKKKKKKKKKCKKKKKKKRKKKKKKKKKKCKKKCKKRKKCRKKRKKKKKKKKKKKKKCKKKKRKKKKRKKKKCKKKKKRKKKKKKKKKKKKKKKKKKKKRKKKKKKKWKKKKKKKKKKKCKKKK
如果我将用户更改为 apache 并发出 ulimit -u 我得到 1024
有什么想法吗?
您需要 FULL stop/start 才能使 mpm 更改生效,重新启动或 graceful 仍会为您提供以前的设置。
我终于明白为什么 Apache 无法创建超过 400 个 worker。这是因为配置文件格式。
在我们的 httpd.conf 文件中,worker 和 prefork 模块的设置写在“LoadModule”部分之前。似乎 apache 不喜欢这种格式,所以它忽略了我们的工作模式值并回退到默认值。
修复非常简单,我们必须从“LoadModules”部分删除worker和prefork模块的设置,并将它们放在这部分之后。
这些值最适合 1000 个并发连接:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
ServerLimit 40
StartServers 5
MinSpareThreads 25
MaxSpareServers 75
MaxRequestWorkers 1000
ThreadsPerChild 25
MaxConnectionsPerChild 0
</IfModule>
#
# worker MPM
# StartServers: initial number of -erver processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
ServerLimit 40
StartServers 5
MinSpareThreads 25
MaxSpareThreads 75
MaxRequestWorkers 1000
ThreadsPerChild 25
MaxConnectionsPerChild 0
</IfModule>
之后只是 stop/start apache 进程。
我已将默认配置更改为:
<IfModule worker.c>
ServerLimit 20
StartServers 4
MaxRequestWorkers 600
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 30
MaxConnectionsPerChild 0
</IfModule>
并且在峰值时,使用服务器状态,当它达到 400 个会话时,它似乎仍然没有创建新的工作人员并保持在 400:
BusyWorkers: 400
IdleWorkers: 0
Scoreboard: KKKKCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKRKCKKKKKKCKKRKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKRKKKKKCKKKCKKKKKRKKKCKKKKKKCKKKKKKKKKKKKRCKKCKKKCKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCKKKRKKKKKKKRKKKKKKKKKKKKKCKCKKKKKCKKKCKCKKRCRKKKKKKKKKKKKRKKKKKKKKKKKKKKCKKKKCKKKKKRKCCKKKKKKKKKKKKKKCKKKKKKKRKKKKKKKKKKCKKKCKKRKKCRKKRKKKKKKKKKKKKKCKKKKRKKKKRKKKKCKKKKKRKKKKKKKKKKKKKKKKKKKKRKKKKKKKWKKKKKKKKKKKCKKKK
如果我将用户更改为 apache 并发出 ulimit -u 我得到 1024
有什么想法吗?
您需要 FULL stop/start 才能使 mpm 更改生效,重新启动或 graceful 仍会为您提供以前的设置。
我终于明白为什么 Apache 无法创建超过 400 个 worker。这是因为配置文件格式。 在我们的 httpd.conf 文件中,worker 和 prefork 模块的设置写在“LoadModule”部分之前。似乎 apache 不喜欢这种格式,所以它忽略了我们的工作模式值并回退到默认值。 修复非常简单,我们必须从“LoadModules”部分删除worker和prefork模块的设置,并将它们放在这部分之后。
这些值最适合 1000 个并发连接:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
ServerLimit 40
StartServers 5
MinSpareThreads 25
MaxSpareServers 75
MaxRequestWorkers 1000
ThreadsPerChild 25
MaxConnectionsPerChild 0
</IfModule>
#
# worker MPM
# StartServers: initial number of -erver processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
ServerLimit 40
StartServers 5
MinSpareThreads 25
MaxSpareThreads 75
MaxRequestWorkers 1000
ThreadsPerChild 25
MaxConnectionsPerChild 0
</IfModule>
之后只是 stop/start apache 进程。