spy*_*don 1 linux vps memory centos top
Top 没有准确显示我的内存使用情况,还是我的 VPS 提供商做了一些奇怪的事情?正如您在下图中看到的,它使用了 90% 以上的内存,但是当您查看实际使用内存的进程时,它甚至没有超过 30%。我知道当进程具有共享内存时,top 无法正确显示,但例如,使用共享内存的 httpd 进程几乎不占用所有可用内存的任何百分比,即使汇总后也是如此。
图中top命令是按照内存使用情况排序的,所以没有大进程隐藏。
https://i.stack.imgur.com/4h2aW.png (显然我没有足够的声誉来发布图片是问题。)
将顶部输出更新为文本:
Tasks: 49 total, 1 running, 48 sleeping, 0 stopped, 0 zombie
Cpu(s): 17.7%us, 1.1%sy, 0.0%ni, 81.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.3%st
Mem: 2097152k total, 1858988k used, 238164k free, 0k buffers
Swap: 2097152k total, 140740k used, 1956412k free, 1089504k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
812 mysql 20 0 513m 241m 5104 S 4.7 11.8 108:32.39 mysqld
882 root 20 0 344m 219m 6116 S 0.0 10.7 1:08.81 clamd
26111 root 20 0 851m 34m 9720 S 0.0 1.7 1:30.03 java
22155 cpanelro 20 0 94272 10m 2392 S 0.0 0.5 0:00.04 cpsrvd-ssl
22260 cpanelro 20 0 94092 9792 2272 S 0.0 0.5 0:00.02 cpsrvd-ssl
21175 cpanelro 20 0 94092 9704 2276 S 0.0 0.5 0:00.03 cpsrvd-ssl
7491 root 20 0 47732 8520 2176 S 0.0 0.4 0:00.10 leechprotect
623 named 20 0 245m 5256 1940 S 0.3 0.3 11:58.59 named
1639 root 20 0 46644 5172 1408 S 0.0 0.2 1:46.64 tailwatchd
1472 root 20 0 93828 4972 1352 S 0.0 0.2 0:17.42 cpsrvd-ssl
23781 root 20 0 38800 4928 2160 S 0.0 0.2 0:00.57 zsh
17788 nobody 20 0 69072 4336 2488 S 0.0 0.2 0:00.21 httpd
917 root 20 0 68588 4288 3000 S 0.0 0.2 0:28.16 httpd
21152 nobody 20 0 69124 4224 2456 S 0.0 0.2 0:00.05 httpd
20549 nobody 20 0 68992 3716 1996 S 0.0 0.2 0:00.07 httpd
20550 nobody 20 0 68992 3536 1792 S 0.0 0.2 0:00.06 httpd
21996 nobody 20 0 68992 3508 1788 S 0.0 0.2 0:00.02 httpd
20544 nobody 20 0 68992 3484 1804 S 0.0 0.2 0:00.05 httpd
21995 nobody 20 0 68992 3432 1704 S 0.3 0.2 0:00.02 httpd
22228 nobody 20 0 68992 3396 1704 S 0.0 0.2 0:00.00 httpd
22226 nobody 20 0 68588 3300 1924 S 0.0 0.2 0:00.00 httpd
21154 nobody 20 0 68720 3172 1716 S 0.0 0.2 0:00.03 httpd
Run Code Online (Sandbox Code Playgroud)
使用 free -m 更新:
free -m
total used free shared buffers cached
Mem: 2048 1864 183 0 0 1063
-/+ buffers/cache: 800 1247
Swap: 2048 137 1910
Run Code Online (Sandbox Code Playgroud)
请记住,“活动”内存和“消耗”内存之间是有区别的。Linux 倾向于在内存中存储大量数据,以备将来需要。但进程可能不会主动使用该内存 - 在这种情况下,它们会报告“已使用”内存量较低。
如果一个进程突然需要更多内存,那么内核将释放一些缓存的数据,并允许该进程使用它。
因此从技术上讲,内存同时是“已使用”和“空闲”的。
您应该熟悉“ free ”命令。我也喜欢使用htop而不是 top,因为它显示了这些差异。
这是之前的一个问题,已经得到很好的回答。读一读,您应该可以更好地理解如何解释“顶级”数据。
| 归档时间: |
|
| 查看次数: |
20974 次 |
| 最近记录: |