当前位置:首页 > 操作系统 > Linux

在不显示在缓存中时追踪Linux内存使用情况

在你拿出你的干草叉之前,我无法追踪内存进入Linux的缓存系统的位置.我已经看过Linux ate my RAM!,How to see top processes by actual memory usage?Correctly determining memory usage in Linux但是使用这些作为示例,这些数字与我在系统上看到的数字并不完全相符.

对于这个系统,我理解它可能是“缓存”的,或者被程序使用,但数字甚至都没有为我增加.

在顶部,我看到.

top - 09:04:09 up 19 days, 20:38,  2 users,  load average: 0.00, 0.10, 0.11
Tasks: 160 total,   1 running, 159 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.2%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  65974296k total, 43507804k used, 22466492k free,   305336k buffers
Swap:  7548924k total,        0k used,  7548924k free,  1480836k cached

我明白了,43GB的RAM“使用”并不是真的,可能大多数可能是缓存的.所以深入研究我跑:

$free -m
             total       used       free     shared    buffers     cached
Mem:         64428      38845      25582          0        298       1445
-/+ buffers/cache:      37101      27326
Swap:         7371          0       7371

所以这表明它确实使用了37GB并且只缓存了1445MB(这是我预期看到的1445就像20000的地方).我上面链接的网站显示“缓存”列通常很高.
因此,我进一步挖掘并执行以下操作来检查使用内存的应用程序.

    sudo smem -t
      PID User     Command                         Swap      USS      PSS      RSS
9468
    21475 root     python /usr/bin/smem -t            0     6212     6234     6984
     2431 root     /opt/OV/lbin/perf/coda             0     7156     8060    12068
     2213 root     /opt/perf/bin/perfd                0    19056    19485    22032
    20849 root     /opt/shiny-server/ext/node/        0    77244    77321    78616
    21325 atpa     /usr/lib64/R/bin/exec/R --n        0  3729836  3733774  3739520
    21287 atpa     /usr/lib64/R/bin/exec/R --n        0  4060136  4064074  4069820
    -------------------------------------------------------------------------------
       63 11     

                                     0  7947984  7970344  8054032

所以R的两个应用程序使用~8GB的内存.

我上面链接的其他文章表明Linux“保留”内存并将其保存在缓存中(例如free -m显示缓存在“Mem:”行上是高值),而在我的情况下,它似乎实际上在使用但是没有应用程序实际上似乎报告了内存的使用情况,我似乎无法追踪Linux正在使用(缓存/保留?)内存的位置.

这个记忆在哪里?我假设Linux正在使用它,但我无法确定它的使用位置.

/ proc / meminfo显示

MemTotal:       65974296 kB
MemFree:        24191624 kB
Buffers:          305320 kB
Cached:          1480760 kB
SwapCached:            0 kB
Active:          7769776 kB
Inactive:         215532 kB
Active(anon):    6199392 kB
Inactive(anon):      476 kB
Active(file):    1570384 kB
Inactive(file):   215056 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       7548924 kB
SwapFree:        7548924 kB
Dirty:               116 kB
Writeback:             0 kB
AnonPages:       6172696 kB
Mapped:            47400 kB
Shmem:               652 kB
Slab:             255468 kB
SReclaimable:     225620 kB
SUnreclaim:        29848 kB
KernelStack:        1736 kB
PageTables:        18780 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    40536072 kB
Committed_AS:    6455352 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      247288 kB
VmallocChunk:   34359487760 kB
HardwareCorrupted:     0 kB
AnonHugePages:   2586624 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       10240 kB
DirectMap2M:    67098624 kB

解决方法:

我想我发现了我的问题……

我的问题似乎是VMware的内存膨胀系统.基本上,这是主机系统向客户操作系统施加内存压力的一种方式,当其他主机开始使用大量内存时消耗客户机内存分配.

http://www.vfrank.org/2013/09/18/understanding-vmware-ballooning/

如果您使用的是VMware,请运行该命令

vmware-toolbox-cmd stat balloon

这将显示膨胀的内存量.

为了我

#:vmware-toolbox-cmd stat balloon
32425 MB

其他来源:https://serverfault.com/questions/660080/detect-memory-ballooning-from-within-the-affected-vm

关闭膨胀的内存以验证问题

Unballooning memory:https://serverfault.com/questions/528295/unballooning-ram-thats-been-ballooned-by-vmware


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐