我有 64G 内存、12coreX3CPU、SATA HDD...但内存使用了 %5 ?? 如何增加此限制?
顶部 https://i.stack.imgur.com/STqtm.png
顶部-c https://i.stack.imgur.com/TpjAx.png
[root@ns228430 ~]# free -m
total used free shared buffers cached
Mem: 64461 13329 51131 0 1444 4334
-/+ buffers/cache: 7550 56910
Swap: 1025 0 1025
[root@ns228430 ~]#
[root@ns228430 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.swappiness = 60
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.eth0.autoconf = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.eth0.accept_ra = 0
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 240
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 28800
net.netfilter.nf_conntrack_max = 256000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.core.somaxconn = 262144
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_tw_recycle = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
我当前的 Apache prefork 设置
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 4450
MaxClients 4450
MaxRequestsPerChild 10000
</IfModule>
重启后,内存使用率下降。我现在安装了 LiteSpeed,但没有任何变化:( http://i.hizliresim.com/PYPgXb.png
答案1
Apache 会根据您的 prefork 设置使用所需的 RAM 量(假设您使用的是 prefork MPM,这几乎是肯定的)。您需要研究以下每个选项,以了解您的硬件可以处理多少 RAM:
<IfModule prefork.c>
StartServers 4
MinSpareServers 3
MaxSpareServers 10
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 10000
</IfModule>
此外,这一切都取决于您的 Apache 实例是否真的需要这些资源。使用 64GB 的 RAM,除非您要处理成千上万的并发用户,否则您不会单独为 Apache 使用那么多 RAM。