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

我有几个运行centos 64bit的高内存linux服务器,在正常运行10到20天之后,我注意到在所有这些服务器上,他们实际上并没有使用所有可用的ram(它们在48gb系统上都有大约10gb的空闲空间)在64GB系统上免费使用20GB。

他们是networking服务器,并有一个工作数据集(如活动文件)超过在服务器的RAM的数量,所以我会假设页面caching将增长到使用所有内存的点,然后从页面caching页面当/如果需要时被释放。

例如 :

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天,但是在页面caching中应该使用10GB的ram。

下面的sysctl是从stock centos设置的:

 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 

四尝试改变现在一对多的sysctl的! ,希望有一些灵魂可能已经看到过,预先感谢任何帮助。

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

这个问题是由于你有多个cpu(不是多核),例如每个xp有2个cpu

vm.zone_reclaim_mode = 0

解决了这个问题。

我不确定这里有什么问题。 您是否遇到其他问题,如高磁盘IO?

大多数软件的devise并不是因为它可以消耗所有的内存。 您没有提及您正在使用的Web服务器软件,但是大多数Web服务器软件都会有内部algorithm,devise用来刷新caching中的对象,如果这些对象没有足够频繁的请求。 他们也有可configuration的机制,旨在控制他们在服务器上消耗的资源量。

假设您使用的是Apache,Apache文档的性能调整部分有一个关于调整MaxRequestWorkers的部分:

您可以并应该控制MaxRequestWorkers设置,以便您的服务器不会产生太多开始交换的子项。 这个过程很简单:通过顶层等工具查看进程列表,确定Apache平均进程的大小,然后将其分配到全部可用内存中,为其他进程留下空间。

如果您使用的是Apache,并且您已经这样做了,那么您可能没有足够的请求来为Apache维护所有这些工作人员。 也可能是因为你对工人数量的估计太低了,你可以增加MaxRequestWorkers来试图让Apache产生更多的工人。

除非您遇到其他问题,否则听起来并不是什么错误。 但无论如何,这可能是一个Web服务器软件configuration问题,而不是一个sysctl之一。

任何不用于程序的RAM都被用作磁盘caching。 所以理论上所有的RAM都被使用了。 一个很好的解释是: http : //www.linuxatemyram.com/