linux – 高内存64位服务器,不使用所有内存

前端之家收集整理的这篇文章主要介绍了linux – 高内存64位服务器,不使用所有内存前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有几个运行centos 64bit的高内存 Linux服务器,经过10-20天的正常运行时间,我注意到所有这些服务器上他们实际上并没有使用所有可用的ram(它们在48gb系统上都有大约10gb空闲,并且在64gb系统上免费20gb.

它们是Web服务器,并且在服务器中具有超过ram数量的工作数据集(例如活动文件),因此我假设页面缓存将增长到使用所有ram然后页面缓存中的页面将会在需要时被释放.

例如 :

top - 09:44:46 up 57 days,9:32,5 users,load average: 6.44,6.33,6.27
Tasks: 680 total,4 running,676 sleeping,0 stopped,0 zombie
cpu(s): 17.3%us,3.3%sy,0.0%ni,79.0%id,0.1%wa,0.0%hi,0.3%si,0.0%st
Mem:  49313212k total,39277524k used,10035688k free,1247064k buffers
Swap: 20643832k total,0k used,20643832k free,20592968k cached

显示此服务器已启动57天,但是有10GB的ram free应该在页面缓存中使用.

以下sysctl是从库存中心设置的:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 1
error: "kernel.maps_protect" is an unknown key
net.core.rmem_default = 8388608
net.core.wmem_default = 8388608
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_max_syn_backlog = 4096
net.core.netdev_max_backlog = 20000
vm.min_free_kbytes = 85536
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_syn_backlog = 6000
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_fin_timeout = 40
net.ipv4.tcp_keepalive_time = 1000
net.ipv4.tcp_keepalive_probes = 2
net.ipv4.tcp_keepalive_intvl = 30
net.netfilter.nf_conntrack_tcp_timeout_established = 2000
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
kernel.panic = 40
fs.proc_can_see_other_uid = 0
net.ipv4.ipfrag_secret_interval = 6000
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_max_tw_buckets_ub = 720000
net.core.optmem_max = 25165824
fs.proc_can_see_other_uid = 0
fs.proc_super_gid = 32010
vm.swappiness = 2
fs.file-max = 400000
fs.suid_dumpable = 1
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

iv尝试改变现在一对多的sysctl!希望有些善良的人可能已经看过这个,提前感谢任何帮助.

解决方法

我回到这里回答我自己的问题!

当你有多个cpu(而不是多核),例如每个带有x核的2个cpu,就会引起这个问题

vm.zone_reclaim_mode = 0

解决这个问题.

猜你在找的Linux相关文章