内存负载查看工具

作者: admin 分类: Linux 发布时间: 2018-07-17 16:50 浏览:1,081 次    
  • free
[root@localhost ~]# free -m
  total used free shared buff/cache available
Mem: 979 141 113 6 723 621
Swap: 1023 0 1023

相关参数解释:

total 内存总数
used 已经使用的内存数
free 空闲的内存数
shared 当前已经废弃不用
buffers Buffer 读出数据缓存内存数
cached Page 写入数据缓存内存数
  • 查看内存信息
[root@localhost ~]# cat /proc/meminfo 
MemTotal: 1003160 kB
MemFree: 116572 kB
MemAvailable: 636044 kB
Buffers: 0 kB
Cached: 526084 kB
SwapCached: 24 kB
Active: 320352 kB
Inactive: 255896 kB
Active(anon): 15512 kB
Inactive(anon): 41740 kB
Active(file): 304840 kB          #活跃内存
Inactive(file): 214156 kB        #非活跃内存
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 1048572 kB
SwapFree: 1048520 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 50172 kB
Mapped: 29096 kB
Shmem: 7088 kB
Slab: 215200 kB
SReclaimable: 169412 kB
SUnreclaim: 45788 kB
KernelStack: 8208 kB
PageTables: 5504 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1550152 kB
Committed_AS: 384832 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 185596 kB
VmallocChunk: 34359535100 kB
HardwareCorrupted: 0 kB
AnonHugePages: 6144 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 49024 kB
DirectMap2M: 999424 kB

 

实战:

查看使用最多内存进程

  • top
[root@localhost ~]# top      #按大写M 
top - 16:45:28 up 6:39, 2 users, load average: 0.00, 0.01, 0.05
Tasks: 357 total, 2 running, 355 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 1003160 total, 116228 free, 145680 used, 741252 buff/cache
KiB Swap: 1048572 total, 1048520 free, 52 used. 635700 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
 771 root 20 0 550184 15904 5404 S 0.0 1.6 0:04.28 tuned 
 1073 root 20 0 474944 11312 7332 S 0.0 1.1 0:00.28 libvirtd 
 844 polkitd 20 0 516072 10648 4356 S 0.0 1.1 0:00.19 polkitd 
 760 root 20 0 660676 9872 6024 S 0.0 1.0 0:06.52 NetworkManager 
 36244 root 20 0 137904 5412 4076 S 0.0 0.5 0:01.44 sshd 
 36480 root 20 0 137904 5408 4076 S 0.0 0.5 0:00.11 sshd 
 753 root 20 0 214240 5220 3612 S 0.0 0.5 0:00.02 abrtd 
 772 root 20 0 326572 4632 3536 S 0.0 0.5 0:00.04 ModemManager 
 755 root 20 0 211984 4496 3140 S 0.0 0.4 0:00.06 abrt-watch-log 
 756 root 20 0 211984 4492 3136 S 0.0 0.4 0:00.00 abrt-watch-log 
 762 root 20 0 268816 4260 3412 S 0.0 0.4 0:31.58 vmtoolsd 
 1 root 20 0 56632 4180 2424 S 0.0 0.4 0:03.76 systemd
  • ps
[root@localhost ~]# ps -aux --sort -rss |head           #加减号为降序,去则升
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 771 0.0 1.5 550184 15904 ? Ssl 10:06 0:04 /usr/bin/python -Es /usr/sbin/tuned -l -P
root 1073 0.0 1.1 474944 11312 ? Ssl 10:06 0:00 /usr/sbin/libvirtd
polkitd 844 0.0 1.0 516072 10648 ? Ssl 10:06 0:00 /usr/lib/polkit-1/polkitd --no-debug
root 760 0.0 0.9 660676 9872 ? Ssl 10:06 0:06 /usr/sbin/NetworkManager --no-daemon
root 36244 0.0 0.5 137904 5412 ? Ss 12:58 0:01 sshd: root@pts/3
root 36480 0.0 0.5 137904 5408 ? Ss 13:15 0:00 sshd: root@pts/4
root 753 0.0 0.5 214240 5220 ? Ss 10:06 0:00 /usr/sbin/abrtd -d -s
root 772 0.0 0.4 326572 4632 ? Ssl 10:06 0:00 /usr/sbin/ModemManager
root 755 0.0 0.4 211984 4496 ? Ss 10:06 0:00 /usr/bin/abrt-watch-log -F

 

 


温馨提示:如无特殊说明,本站文章均为作者原创,转载时请注明出处及相应链接!

发表评论