新的 Apache 2.4 MPM-Event 服务器:(22)无效参数:ap_queue_pop 失败

新的 Apache 2.4 MPM-Event 服务器:(22)无效参数:ap_queue_pop 失败

订购并设置了新的 Web 服务器(64 位、4 vCores、6GB RAM、Ubuntu 14.04)后,使用 Apache 2.4.7(和 PHP7 fpm)作为事件 MPM,但在流量高峰期,Apache 崩溃了。错误日志中充满了数百条条目(即使在流量较少的时段也是如此),如下所示:

[Thu Jul 21 17:51:16.633617 2016] [mpm_event:crit] [pid 9290:tid 139705492948732] (22)Invalid argument: ap_queue_pop failed
[Thu Jul 21 17:51:16.633622 2016] [mpm_event:crit] [pid 9290:tid 139705492948732] (22)Invalid argument: ap_queue_pop failed
[Thu Jul 21 17:51:16.633627 2016] [mpm_event:crit] [pid 9290:tid 139705492948732] (22)Invalid argument: ap_queue_pop failed
[Thu Jul 21 17:51:18.632095 2016] [mpm_event:alert] [pid 9313:tid 139705857640190] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread
[Thu Jul 21 17:51:19.632842 2016] [mpm_event:alert] [pid 9337:tid 139705857640190] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread

我已经通过以下方式默认设置了较高的系统限制ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1546681
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1546681
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

来自 Mozilla 的博客文章也没有帮助,因为我的限额已经远远高于他们建议的限额。我还读了增加privvmpages价值但它也很高:

$ cat /proc/user_beancounters
Version: 2.5
       uid  resource                     held              maxheld              barrier                limit              failcnt
   130922:  kmemsize                173862701            175349760  9223372036854775807  9223372036854775807                    0
            lockedpages                     0                    0              1572864              1572864                    0
            privvmpages               3327626              3330707              3670016              3670016                31705
            shmpages                    92638                92638  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            numproc                       279                  363                  850                  850                    0
            physpages                  356751               363453                    0              1572864                    0
            vmguarpages                     0                    0              1835008              1835008                    0
            oomguarpages               121370               121370              1572864              1572864                    0
            numtcpsock                     69                   72  9223372036854775807  9223372036854775807                    0
            numflock                       11                   12  9223372036854775807  9223372036854775807                    0
            numpty                          2                    2  9223372036854775807  9223372036854775807                    0
            numsiginfo                      0                   63  9223372036854775807  9223372036854775807                    0
            tcpsndbuf                 1368640              1445072  9223372036854775807  9223372036854775807                    0
            tcprcvbuf                 1938112              1987264  9223372036854775807  9223372036854775807                    0
            othersockbuf               233512               241968  9223372036854775807  9223372036854775807                    0
            dgramrcvbuf                     0                    0  9223372036854775807  9223372036854775807                    0
            numothersock                  148                  150  9223372036854775807  9223372036854775807                    0
            dcachesize               61545508             61876256  9223372036854775807  9223372036854775807                    0
            numfile                      2133                 2280  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            numiptent                     338                  338  9223372036854775807  9223372036854775807                    0

$ free -m 
             total       used       free     shared    buffers     cached
Mem:          6144       1823       4320        361          0       1553
-/+ buffers/cache:        270       5873
Swap:         1024          0       1024

该网站一天总共收到 500,000 个请求,但之前它运行在更旧(软件/硬件)和更小的服务器上(资源只有一半),没有任何(资源)问题。我的 mpm-event 设置:

<IfModule mpm_event_module>
    StartServers             5
    ServerLimit              32
    MinSpareThreads          60
    MaxSpareThreads          200
    ThreadLimit              64
    ThreadsPerChild          25
    MaxRequestWorkers        800
    MaxConnectionsPerChild   20000
</IfModule>

负载通常约为 0.05,并且 RAM 的使用率通常不超过 10%。知道我做错了什么吗?

(小注:这是我利用业余时间开发的一项人们免费使用的服务。)

相关内容