大网数据广告活动
服务器运维问答

Zero idle workers in apache2 server causing performance issues

· 52CE 我爱测

I have a SAAS product built on php along with apache2 and mysql and it has been hosted on AWS. My production is very very slow on peak times and when I check server-status then it says idle workers are 0 (zero) I am using mpm-pre…

问题原文

原帖链接 · Rahul · CC BY-SA 4.0

I have a SAAS product built on php along with apache2 and mysql and it has been hosted on AWS. My production is very very slow on peak times and when I check server-status then it says idle workers are 0 (zero) I am using mpm-prefork

Current Time: Monday, 24-Aug-2020 19:36:32 UTC
Restart Time: Friday, 14-Aug-2020 06:03:27 UTC
Parent Server Config. Generation: 12
Parent Server MPM Generation: 11
Server uptime: 10 days 13 hours 33 minutes 5 seconds
Server load: 1.17 1.07 0.95
Total accesses: 28851443 - Total Traffic: 824.8 GB
CPU Usage: u289.99 s50.68 cu0 cs0 - .0373% CPU load
31.6 requests/sec - 0.9 MB/second - 30.0 kB/request
256 requests currently being processed, 0 idle workers

following is my mpm-prefork.conf setting file

<IfModule mpm_prefork_module>
        StartServers                     5
        MinSpareServers           5
        MaxSpareServers          10
        MaxRequestWorkers         450
        MaxConnectionsPerChild   0
</IfModule>

TOP command on ubuntu20.04 gives me this:

top - 20:03:58 up 143 days, 11:16,  1 user,  load average: 0.48, 0.71, 0.83
Tasks: 369 total,   3 running, 317 sleeping,   0 stopped,   0 zombie
%Cpu(s): 15.9 us,  3.2 sy,  0.0 ni, 79.9 id,  0.0 wa,  0.0 hi,  1.0 si,  0.0 st
KiB Mem :  7865072 total,  1023492 free,  2752320 used,  4089260 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  4755856 avail Mem

As per details, I can see 1 GB ram is still free. then wny zero idle workers ? also, why zero idle workers on just 256 requests when I set MaxRequestWorkers to 450. Maximum RAM in machine is 8GB

已采纳解答

原帖链接 · tater · CC BY-SA 4.0

With MPM prefork, if you increase MaxRequestWorkers you also need to raise ServerLimit.

For non-threaded servers (i.e., prefork), MaxRequestWorkers translates into the maximum number of child processes that will be launched to serve requests. The default value is 256; to increase it, you must also raise ServerLimit.

https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-08-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。