这台服务器是交换使用100%(15G交换磁盘),而它仍然有30G免费,我一直在寻找周围,但不能确定为什么发生这种情况,我的理解是不使用交换,如果内存仍然可用。
#cat / proc / meminfo MemTotal:131937984 kB MemFree:29649644 kB 缓冲区:347424 kB caching:55013896 kB SwapCached:2180808 kB Active:42065900 kB Inactive:15782332 kB HighTotal:0 kB HighFree:0 kB LowTotal:131937984 kB LowFree:29649644 kB SwapTotal:16779884 kB SwapFree:2165300 kB 脏:1908 kB 写回:0 kB AnonPages:323104 kB 映射:31100628 kB 板:408604 kB PageTables:1737344 kB NFS_Unstable:0 kB 弹跳:0 kB CommitLimit:61777356 kB Committed_AS:52238240 kB VmallocTotal:34359738367 kB VmallocUsed:382524 kB VmallocChunk:34359355491 kB HugePages_Total:20480 HugePages_Free:20480 HugePages_Rsvd:0 Hugepagesize:2048 kB # 最佳 顶部 - 14:33:16最多27天,21:25,7个用户,平均负载:3.47,4.39,4.34 任务:总共669次,跑步2次,睡眠661次,停止0次,僵尸6次 Cpu:7.6%us,1.5%sy,0.0%ni,90.2%id,0.6%wa,0.0%hi,0.1%si,0.0%st Mem:131937984k共计,101503048k使用,30434936k自由,347544k缓冲 交换:总计16779884k,使用14608832k,存储2171052k,存储54216540k #vmstat 1 procs -----------内存---------- --- swap-- ----- io -----system-- ----- cpu ------ rb swpd free buff cache si so bi bo in cs us sy id wa st 1 0 14608504 30438520 347560 54216984 1 1 503 262 0 0 8 2 90 1 0 3 0 14608504 30439016 347560 54217024 0 0 88 403 1434 4884 0 0 99 0 0 2 0 14608468 30439760 347560 54217060 0 0 10 588 2381 5297 7 1 93 0 0 0 0 14608468 30439884 347560 54217060 0 0 0 76 1429 4768 5 0 94 0 0 1 0 14608448 30440180 347560 54217048 32 0 66 230 3371 4872 4 1 95 0 0 6 0 14608420 30440668 347560 54217076 32 0 42 320 2439 4860 6 1 93 0 0 3 0 14608412 30441384 347560 54217116 0 0 58 520 2128 4899 6 1 93 0 0 4 0 14608412 30441504 347560 54217116 0 0 0 58 1355 4477 11 1 88 0 0 3 0 14608392 30441844 347560 54217012 128 0 158 16 1491 4374 13 1 86 0 0 5 1 14608352 30441512 347560 54216924 160 0 296 640 2748 5279 15 2 83 0 0 4 0 14608324 30442132 347564 54217112 32 0 90 502 2493 4878 13 1 86 0 0 8 0 14608296 30437288 347568 54217204 0 0 8 724 2243 5185 12 1 86 0 0 #cat / proc / sys / vm / swappiness 60 bash-3.2#grep ^ [az] /etc/sysctl.conf 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_source_route = 0 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 net.ipv4.conf.all.log_martians = 0 net.ipv4.conf.default.log_martians = 0 kernel.panic_on_oops = 1 kernel.panic = 5 fs.aio-max-nr = 399360 kernel.exec-shield = 0 kernel.randomize_va_space = 0 vm.nr_hugepages = 20480 net.ipv4.tcp_keepalive_time 300
一个选项可能会将swappiness从60更改为更低的数字
一个朋友有这个确切的问题。 我假设你有一个多核系统。 正因为如此,Linux将每个处理器的总物理内存分配(即如果你有一个4核和16个内存的话,每个内核就有4个内核)。 当所有可用的RAM用完特定的处理器时,它将继续使用交换空间,而不是从其他处理器中提取空闲的RAM。
让我联系他,看看他得到了什么确切的解决scheme,也许这个答案可以指向正确的方向在此期间。
我有一个CentOS 5的Sybase服务器,导致不交换。 诀窍是将swappiness设置为0,并为操作系统留下足够的内存。 服务器有16GB(Sybase为10GB,操作系统和其他服务为6GB)。 从较小的Sybasecaching开始逐步增加。
[root@db2 ~]# tail -2 /etc/sysctl.conf # Set Swappiness vm.swappiness = 0
您可能正在运行在进程内存中维护大型caching的软件。 当另一个需要内存的任务运行时,这些页面将被换出。 内存将不会被交换回去,所以当其他需要内存的任务完成时,将会有很多空闲内存直到需要时才会被填充。
如果你有一个在NUMA系统上分配了大量内存的进程,它可能只是让它拥有属于一个NUMA节点的内存。
读一下这个:
http://jcole.us/blog/archives/2010/09/28/mysql-swap-insanity-and-the-numa-architecture/
底线是:如果你可以用它来使用所有的内存,它可能会更好。
但是,告诉你的数据库使用32G的32G似乎是乐观的,因为会有很大的开销。 特别是在x86_64上,页表会占用很多空间(可能是.5 G?),系统的其他部分将需要一些空间。 我认为约75%是更好的设置。