php-fpm invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
在优化WordPress服务器MySQL内存配置之后,跑了两天出现了php-fpm oom-killer导致网站无法访问,接上一篇:阿里云WordPress服务器MySQL内存优化配置,继续Apache服务器的优化配置修改。
一、网站无法访问异常分析
还是在阿里云轻量应用服务器控制台,进入应用详情模块,在远程连接之后(WordPress信息模块和MySQL信息模块远程连接功能相同),同样输入以下命令过滤异常Log:
sudo cat /var/log/messages | grep kill
继续过滤异常时候的Log,这边因为出现多次问题,取最近的一次Log来分析,先过滤kill关键字:
Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: php-fpm invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81184d0e>] oom_kill_process+0x24e/0x3c0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811847ad>] ? oom_unkillable_task+0xcd/0x120
接着把对应时间点下的Log在控制台都打印出来,拷贝OOM异常发生时候的Log,先用下面的命令在控制台打印所有Log:
sudo cat /var/log/messages
在控制台打出的Log输出到对应异常时间点的时候用全选和拷贝快捷键把Log拷贝出来(使用Ctrl+C无法终止打印),发生OOM的时候异常Log信息如下:
Jul 26 17:20:01 iz2zegxchxpm4qt6yqfvd3z crond: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: php-fpm invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: php-fpm cpuset=/ mems_allowed=0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: CPU: 0 PID: 29589 Comm: php-fpm Not tainted 3.10.0-514.26.2.el7.x86_64 #1 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 3288b3c 04/01/2014 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: ffff88003d782f10 00000000d3a66afc ffff8800100df910 ffffffff81687133 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: ffff8800100df9a0 ffffffff816820de ffffffff810eb0dc ffff88003c2b8c20 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: ffff88003c2b8c38 ffff8800100df9f8 ffff88003d782f10 0000000000000000 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Call Trace: Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81687133>] dump_stack+0x19/0x1b Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff816820de>] dump_header+0x8e/0x225 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff810eb0dc>] ? ktime_get_ts64+0x4c/0xf0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81184d0e>] oom_kill_process+0x24e/0x3c0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811847ad>] ? oom_unkillable_task+0xcd/0x120 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81184856>] ? find_lock_task_mm+0x56/0xc0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81093c0e>] ? has_capability_noaudit+0x1e/0x30 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81185546>] out_of_memory+0x4b6/0x4f0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81682be7>] __alloc_pages_slowpath+0x5d7/0x725 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff8118b655>] __alloc_pages_nodemask+0x405/0x420 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811cf9ca>] alloc_pages_current+0xaa/0x170 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81180be7>] __page_cache_alloc+0x97/0xb0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81183760>] filemap_fault+0x170/0x410 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffffa01b6016>] ext4_filemap_fault+0x36/0x50 [ext4] Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811ac83c>] __do_fault+0x4c/0xc0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811accd3>] do_read_fault.isra.42+0x43/0x130 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811b1461>] handle_mm_fault+0x6b1/0x1000 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff811b7f65>] ? do_mmap_pgoff+0x305/0x3c0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff81692cc4>] __do_page_fault+0x154/0x450 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff816930a6>] trace_do_page_fault+0x56/0x150 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff8169274b>] do_async_page_fault+0x1b/0xd0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [<ffffffff8168f238>] async_page_fault+0x28/0x30 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Mem-Info: Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: active_anon:212039 inactive_anon:5034 isolated_anon:0#012 active_file:937 inactive_file:3541 isolated_file:0#012 unevictable:0 dirty:1 writeback:0 unstable:0#012 slab_reclaimable:4520 slab_unreclaimable:3985#012 mapped:5984 shmem:11719 pagetables:3008 bounce:0#012 free:12219 free_pcp:34 free_cma:0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Node 0 DMA free:4596kB min:704kB low:880kB high:1056kB active_anon:9444kB inactive_anon:188kB active_file:40kB inactive_file:588kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15992kB managed:15908kB mlocked:0kB dirty:0kB writeback:0kB mapped:24kB shmem:188kB slab_reclaimable:148kB slab_unreclaimable:296kB kernel_stack:192kB pagetables:160kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:925 all_unreclaimable? yes Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: lowmem_reserve[]: 0 975 975 975 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Node 0 DMA32 free:44280kB min:44348kB low:55432kB high:66520kB active_anon:838712kB inactive_anon:19948kB active_file:3708kB inactive_file:13576kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:1032064kB managed:1000488kB mlocked:0kB dirty:4kB writeback:0kB mapped:23912kB shmem:46688kB slab_reclaimable:17932kB slab_unreclaimable:15644kB kernel_stack:5056kB pagetables:11872kB unstable:0kB bounce:0kB free_pcp:136kB local_pcp:136kB free_cma:0kB writeback_tmp:0kB pages_scanned:22416 all_unreclaimable? yes Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: lowmem_reserve[]: 0 0 0 0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Node 0 DMA: 7*4kB (UEM) 7*8kB (E) 8*16kB (UEM) 3*32kB (UE) 5*64kB (EM) 5*128kB (UEM) 3*256kB (EM) 3*512kB (UEM) 1*1024kB (M) 0*2048kB 0*4096kB = 4596kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Node 0 DMA32: 230*4kB (EM) 290*8kB (UEM) 277*16kB (UE) 162*32kB (EM) 99*64kB (EM) 70*128kB (EM) 39*256kB (UEM) 12*512kB (EM) 0*1024kB 0*2048kB 0*4096kB = 44280kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: 16217 total pagecache pages Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: 0 pages in swap cache Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Swap cache stats: add 0, delete 0, find 0/0 Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Free swap = 0kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Total swap = 0kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: 262014 pages RAM Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: 0 pages HighMem/MovableOnly Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: 7915 pages reserved Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 326] 0 326 8745 513 21 0 0 systemd-journal Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 351] 0 351 10956 262 20 0 -1000 systemd-udevd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 389] 0 389 6047 141 15 0 0 systemd-logind Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 391] 998 391 131878 1877 54 0 0 polkitd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 393] 81 393 6100 121 15 0 -900 dbus-daemon Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 417] 0 417 6460 70 17 0 0 atd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 418] 0 418 31563 217 18 0 0 crond Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 443] 0 443 27508 73 11 0 0 agetty Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 444] 0 444 27508 73 10 0 0 agetty Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 761] 0 761 138286 3200 86 0 0 tuned Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 764] 0 764 57141 542 41 0 0 rsyslogd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 775] 38 775 7353 202 18 0 0 ntpd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 850] 0 850 28844 128 14 0 0 mysqld_safe Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 877] 0 877 8201 452 20 0 0 AliYunDunUpdate Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 927] 0 927 10342 515 24 0 0 staragentd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 966] 0 966 252126 1508 76 0 0 staragent-core Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 967] 0 967 169139 1027 41 0 0 staragent-ppf Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 1247] 0 1247 32219 1123 61 0 0 AliYunDun Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 1308] 1001 1308 282111 60218 179 0 0 mysqld Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 1319] 0 1319 30508 196 12 0 0 wrapper Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 1528] 0 1528 517602 14655 88 0 0 java Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 2479] 1002 2479 69560 1192 66 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 2483] 0 2483 30328 691 62 0 0 httpd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 2827] 0 2827 26369 296 55 0 -1000 sshd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [ 2942] 0 2942 385 20 3 0 0 aliyun-service Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29899] 1002 29899 370609 3504 172 0 0 httpd Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29578] 1002 29578 79481 14037 101 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29581] 1002 29581 79545 14102 101 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29584] 1002 29584 79240 13615 100 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29588] 1002 29588 78344 12805 98 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29589] 1002 29589 78285 12787 98 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29590] 1002 29590 79176 13616 100 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29591] 1002 29591 79175 13615 100 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29594] 1002 29594 78024 12512 98 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29595] 1002 29595 78025 12507 98 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29598] 1002 29598 79382 13537 101 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29599] 1002 29599 76030 12478 95 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29602] 1002 29602 77556 11504 97 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29603] 1002 29603 78068 12089 98 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29607] 1002 29607 76468 10447 95 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29608] 1002 29608 76468 10444 95 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29611] 1002 29611 74104 8025 90 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29612] 1002 29612 74106 8043 90 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29615] 1002 29615 69560 1163 66 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: [29616] 1002 29616 69560 1163 66 0 0 php-fpm Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Out of memory: Kill process 1308 (mysqld) score 237 or sacrifice child Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z kernel: Killed process 1308 (mysqld) total-vm:1128444kB, anon-rss:240872kB, file-rss:0kB, shmem-rss:0kB Jul 26 17:22:00 iz2zegxchxpm4qt6yqfvd3z mysqld: /usr/local/mysql/bin/mysqld_safe: line 196: 1308 Killed nohup /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/iz2zegxchxpm4qt6yqfvd3z.err --pid-file=/usr/local/mysql/data/iz2zegxchxpm4qt6yqfvd3z.pid < /dev/null > /dev/null 2>&1
从Log中的信息可以看到最后面的几行,因为内存不足,牺牲内存占用最高的子进程,这个子进程就是mysqld,占用内存在275MB左右(27.7%),在杀掉mysqld之前也把php-fpm给杀了,网站直接无法访问。
kernel: Out of memory: Kill process 1308 (mysqld) score 237 or sacrifice child kernel: Killed process 1308 (mysqld) total-vm:1128444kB, anon-rss:240872kB, file-rss:0kB, shmem-rss:0kB
也就是说,之前的OOM问题分析并不完全,根本原因并不是MySQL内存不足导致被强杀,而是php-fpm进程占用的内存过多,系统为了保证Apache服务正常运行,就先把除了自身进程之外内存占用最大的子进程给杀了。
在前面把MySQL的内存降下来之后,才暴露出导致OOM问题的根本原因。
前面在用top命令查看内存变化的时候,也就MySQL内存占用最大(27%),但其他进程的内存占用很少,在轻量服务器控制台监控面板上显示1G的内存已使用几乎都在80%左右,Apache进程的内存占用在50%左右。
总共才1G的内存,一旦服务器开了比较多的子进程,剩余不到200MB的内存很快就耗光了,Linux kernel层在应用程序申请内存的时候不管内存是否足够,都会分配内存,这就容易导致时不时的内存溢出异常,单单对MySQL进行优化是不够的,下面就对Apache服务器的配置进行优化。
二、Apache服务器配置优化
查找了一些资料有以下优化配置方法,但并不是每一种都有效,可以分别做下配置测试,看下效果。
1、vm.overcommit配置参数修改
最常见的是下面的配置修改,一个小哥在做了如下配置之后没出现问题,就到处宣传这个方法非常OK,然而自测在WordPress服务器配置了如下参数之后,网站直接无法访问了,赶紧屁颠屁颠回退了修改。后面只保留配置了overcommit_ratio为100,不配置overcommit_memory参数。
其他的服务器不知道配置是否会有问题,可以自行配置修改测试。这个方法查看评论内容是七年前的修改了(服务器内存为4G),小哥也不确定现在这么配置有什么影响。
vm.overcommit_memory = 2 vm.overcommit_ratio = 80
1)如果要修改在哪里配置这两个参数?
输入以下命令查看在“/etc/sysctl.d/”文件夹下可以做修改的文件:
ls /etc/sysctl.d/
输出结果示例:
99-sysctl.conf
接着打开文件:
vim /etc/sysctl.d/99-sysctl.conf
点击按钮“i”进入编辑模式,添加上面两个vm.overcommit参数之后用下面的命令保存退出:
:wq
2)这两个vm.overcommit参数的意义是什么?
vm.overcommit_memory参数值为2表示关闭OOM Killer功能,也就是发生OOM的时候不会进行杀进程操作,这个慎用,不确定会带来什么影响。
vm.overcommit_ratio表示内存的最大使用比例,设置kernel层分配内存的最大比例,设置为80就表示最大使用内存为总内存的80%,设置为100表示不耗尽所有的内存。
3)除了overcommit_ratio的配置,还可以配置在发生OOM进程挂掉之后,重启VM,避免每次自己手动重启服务器。在99-sysctl.conf配置文件中添加下面两个参数的配置。
# panic kernel on OOM
vm.panic_on_oom = 1
# reboot after 5 sec on panic
kernel.panic = 5
2、修改httpd配置文件参数
1)httpd-mpm.conf配置文件修改
可以先用find命令查找这个文件所在的路径:
sudo find / -name httpd-mpm.conf
一般输出的文件在:
/usr/local/apache/conf/extra/httpd-mpm.conf
首次修改文件之前都需要先加下777权限:
sudo chmod 777 /usr/local/apache/conf/extra/httpd-mpm.conf
查看文件权限是否修改:
sudo ls -l /usr/local/apache/conf/extra/httpd-mpm.conf
之后打开文件修改参数:
sudo vim /usr/local/apache/conf/extra/httpd-mpm.conf
我这边mpm_prefork和mpm_worker的默认配置如下:
<IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxRequestWorkers 250 MaxConnectionsPerChild 0 </IfModule> <IfModule mpm_worker_module> StartServers 5 MinSpareThreads 50 MaxSpareThreads 200 ThreadsPerChild 100 MaxRequestWorkers 400 MaxRequestsPerChild 2000 </IfModule>
优化修改之后的配置如下,大部分参数直接减半:
<IfModule mpm_prefork_module> StartServers 2 MinSpareServers 3 MaxSpareServers 6 MaxRequestWorkers 64 MaxConnectionsPerChild 0 </IfModule> <IfModule mpm_worker_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 50 ThreadsPerChild 25 MaxRequestWorkers 100 MaxRequestsPerChild 256 </IfModule>
2)httpd-default.conf配置文件修改
不知道位置的也可以用find命令查找下,一般和httpd-mpm.conf文件在同一个文件夹下。
我这边的默认配置如下,这边的参数个人觉得没必要做调整,维持原样,如果你的服务器配置的数值参数偏大或者偏小,可以另外修改调整下。
# # Timeout: The number of seconds before receives and sends time out. # Timeout 60 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 5
修改以上配置之后查看内存整体占用在75% – 85%范围内波动,先跑跑看,至少加了OOM重启机制,不至于异常之后网站无法访问。
三、参考资料
Effects of configuring vm.overcommit_memory
相关阅读:
转载请注明出处:陈文管的博客 – 阿里云WordPress Apache服务器内存优化配置
扫码或搜索:文呓
微信公众号 扫一扫关注