linux – 我的RAM在哪里?

前端之家收集整理的这篇文章主要介绍了linux – 我的RAM在哪里?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
注意:在你跳得太快之前,是的我读了 linuxatemyram.com

我有一个64GB RAM的服务器.

free -m说我的RAM已满,而且不是因为磁盘缓存:

total       used       free     shared    buffers     cached
Mem:         64458      64117        340        201         67        331
-/+ buffers/cache:      63719        739
Swap:         1532        383       1149

但是,按内存使用排序的最高值不能达到64GB:

KiB Mem:  66005116 total,65652464 used,352652 free,67512 buffers
KiB Swap:  1569780 total,392656 used,1177124 free.   337464 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %cpu %MEM     TIME+ COMMAND
 6258 MysqL     20   0 38.665g 0.033t   4924 S   1.3 54.3 482:26.21 MysqLd
 2293 root      20   0  165896 102116 101964 S   0.0  0.2   0:43.53 systemd-journal
 4909 root      20   0  377548  57840  57548 S   0.0  0.1   0:18.47 rsyslogd
26639 www       20   0  650076  53348  32968 S   0.0  0.1  11:32.27 PHP-fpm
26640 www       20   0  648344  51912  32984 S   0.0  0.1  11:37.43 PHP-fpm
26642 www       20   0  648600  51472  32580 S   0.0  0.1  11:37.16 PHP-fpm
26669 www       20   0  648148  50696  31988 S   0.0  0.1  11:35.24 PHP-fpm
26643 www       20   0  648452  50616  31628 S   0.0  0.1  11:36.19 PHP-fpm
26641 www       20   0  648620  50496  31340 S   0.0  0.1  11:36.51 PHP-fpm
28121 www       20   0  648620  48820  29660 S   0.0  0.1  11:35.75 PHP-fpm
27231 www       20   0  647508  48804  30760 S   0.0  0.1  11:35.61 PHP-fpm
28029 www       20   0  648044  48752  30172 S   0.0  0.1  11:37.20 PHP-fpm
28117 www       20   0  647868  48700  30296 S   0.0  0.1  11:36.45 PHP-fpm
28122 www       20   0  648340  48568  29676 S   0.0  0.1  11:35.73 PHP-fpm
 8569 www       20   0  649028  40268  20704 S   0.0  0.1  11:31.50 PHP-fpm
10126 www       20   0  648432  39420  20700 S   0.0  0.1   9:58.52 PHP-fpm
22386 www       20   0  647996  39400  20868 S   0.0  0.1  11:25.00 PHP-fpm
 9643 www       20   0  647976  39220  20704 S   0.0  0.1  11:29.23 PHP-fpm
23077 www       20   0  647852  39084  20692 S   0.0  0.1  11:11.80 PHP-fpm
10139 www       20   0  647580  38808  20692 S   0.0  0.1   9:59.94 PHP-fpm
 6326 www       20   0  647368  38396  20696 S   0.7  0.1   8:32.34 PHP-fpm
 4727 www       20   0  646128  37304  20692 S   0.0  0.1   8:30.20 PHP-fpm
 5459 www       20   0  645988  37156  20688 S   0.0  0.1   7:15.13 PHP-fpm
 2173 www       20   0  645240  36408  20684 S   0.0  0.1   4:39.13 PHP-fpm
20752 www       20   0  644536  35428  20680 S   0.0  0.1   4:29.78 PHP-fpm
 5396 www       20   0  644468  35324  20692 S   0.0  0.1   4:14.65 PHP-fpm
17558 www       20   0  642668  33816  20740 S   0.0  0.1   1:28.34 PHP-fpm
28133 www       20   0  642780  33636  20704 S   0.0  0.1   0:49.88 PHP-fpm
10925 www       20   0  479584  29264  11212 S   3.0  0.0   0:00.09 PHP
26632 root      20   0  552136  26072  19468 S   0.0  0.0   0:37.74 PHP-fpm
 4946 named     20   0  697996  18748   2104 S   0.0  0.0   3:46.96 named
15609 apache    20   0 2137056   8120   1592 S   0.0  0.0   0:56.18 httpd
 8584 root      20   0  133432   4864   3700 S   0.0  0.0   0:00.08 sshd

MysqL单独使用54.3%,这是完全正常的,因为它的innodb_buffer_pool_size为32G.其他进程的内存使用率大约为2.8%,总计为57.1%.

剩下的32%在哪里?

编辑:/ proc / meminfo的内容

MemTotal:       66005116 kB
MemFree:          353272 kB
Buffers:           66328 kB
Cached:           736620 kB
SwapCached:        11348 kB
Active:         34396680 kB
Inactive:        2651132 kB
Active(anon):   34223240 kB
Inactive(anon):  2228020 kB
Active(file):     173440 kB
Inactive(file):   423112 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       1569780 kB
SwapFree:        1177448 kB
Dirty:               328 kB
Writeback:             0 kB
AnonPages:      36234364 kB
Mapped:           125208 kB
Shmem:            206396 kB
Slab:           28058904 kB
SReclaimable:   28010224 kB
SUnreclaim:        48680 kB
KernelStack:        2760 kB
PageTables:        94780 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    34572336 kB
Committed_AS:   38572348 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      382304 kB
VmallocChunk:   34359353572 kB
HardwareCorrupted:     0 kB
DirectMap4k:        9000 kB
DirectMap2M:     2054144 kB
DirectMap1G:    67108864 kB

slabtop的输出

Active / Total Objects (% used)    : 147380425 / 147413026 (100.0%)
 Active / Total Slabs (% used)      : 7005839 / 7005839 (100.0%)
 Active / Total Caches (% used)     : 71 / 144 (49.3%)
 Active / Total Size (% used)       : 27615020.12K / 27627490.91K (100.0%)
 Minimum / Average / Maximum Object : 0.01K / 0.19K / 16.12K

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
146851887 146851887  12%    0.19K 6992947       21  27971788K dentry
124936 124936 100%    0.07K   2231       56      8924K Acpi-ParseExt
105144 105144 100%    0.10K   2696       39     10784K buffer_head
 49920  49172  98%    0.06K    780       64      3120K kmalloc-64
 29916  29916 100%    0.11K    831       36      3324K sysfs_dir_cache
 29856  29661  99%    0.12K    933       32      3732K kmalloc-128
 21450  21128  98%    0.18K    975       22      3900K vm_area_struct
 19328  19328 100%    0.03K    151      128       604K kmalloc-32
 18258  13383  73%    0.93K    537       34     17184K ext4_inode_cache
 17952  11651  64%    0.04K    176      102       704K ext4_extent_status
 16828   6513  38%    0.55K    601       28      9616K radix_tree_node
 14400  13996  97%    0.06K    225       64       900K anon_vma
 11645   7903  67%    0.05K    137       85       548K shared_policy_node
 10710   7006  65%    0.19K    510       21      2040K kmalloc-192
 10608  10608 100%    0.04K    104      102       416K Acpi-Namespace
  9728   9728 100%    0.01K     19      512        76K kmalloc-8
...

解决方法

OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
146851887 146851887  12%    0.19K 6992947       21  27971788K dentry

你说这不是因为磁盘缓存,但显然是.

我敢打赌,你有一些代码可以为不存在的文件提取大量内容,并且你会得到大量的负面缓存.如果它受到内存压力,Linux将删除这些条目,因此可能无需担心.例如,像在this NSS issue.

原文链接:https://www.f2er.com/linux/401962.html

猜你在找的Linux相关文章