Linux 机器, 内存 64G 用了 63G,但是 top 命令下看到进程占用的并不多,怎么回事?

2017-10-27 19:08:25 +08:00
 esolve

如下:

top - 19:07:54 up 365 days, 5:48, 2 users, load average: 20.16, 20.40, 21.37 Tasks: 308 total, 3 running, 305 sleeping, 0 stopped, 0 zombie Cpu(s): 2.8%us, 2.7%sy, 0.0%ni, 51.0%id, 43.4%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 65857876k total, 64175492k used, 1682384k free, 12292k buffers Swap: 32997372k total, 2303888k used, 30693484k free, 52161468k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
18946 root 20 0 3955m 2.9g 2952 S 2.0 4.6 15876:00 mongod
30209 root 20 0 2220m 2.0g 2488 D 1.0 3.2 6:38.01 python
9170 root 20 0 1979m 1.8g 2488 D 1.0 2.8 5:28.30 python
18595 root 20 0 1784m 1.6g 2488 D 0.0 2.5 5:02.18 python
25182 root 20 0 1271m 1.1g 2352 R 53.1 1.8 2:27.24 python
7570 mysql 20 0 9869m 24m 400 S 0.0 0.0 74:51.32 mysqld
2771 root 20 0 244m 4592 480 S 0.0 0.0 9:00.71 rsyslogd
27845 root 20 0 91916 3704 2900 S 0.0 0.0 0:00.00 sshd
28709 root 20 0 164m 3036 2472 S 0.0 0.0 0:00.02 su
28793 root 20 0 106m 2304 1504 S 0.0 0.0 0:00.00 bash
28628 eversec 20 0 92048 1980 1144 S 0.0 0.0 0:00.00 sshd
21321 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.01 vsftpd
21333 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.02 vsftpd
22275 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.01 vsftpd
27854 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.02 vsftpd
28218 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.02 vsftpd
28963 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.01 vsftpd
29447 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.02 vsftpd
30539 nobody 20 0 58828 1844 1444 S 0.0 0.0 0:00.01 vsftpd
21336 nobody 20 0 58828 1840 1440 S 0.0 0.0 0:00.02 vsftpd
25218 nobody 20 0 58828 1840 1440 S 0.0 0.0 0:00.02 vsftpd
26324 nobody 20 0 58828 1840 1440 S 0.0 0.0 0:00.02 vsftpd
30203 nobody 20 0 58828 1840 1440 S 0.0 0.0 0:00.01 vsftpd
28999 root 20 0 15156 1500 1000 R 0.0 0.0 0:00.09 top
28632 eversec 20 0 103m 1456 1200 S 0.0 0.0 0:00.00 enable
25176 root 20 0 136m 1360 1016 S 0.0 0.0 0:00.00 crond

2157 次点击
所在节点    问与答
15 条回复
liwei
2017-10-27 19:12:29 +08:00
内存闲着也是闲着,linux 为啥不用呢。
blankme
2017-10-27 19:16:59 +08:00
hjc4869
2017-10-27 19:19:08 +08:00
减去 cache
chih
2017-10-27 19:19:37 +08:00
cache 和 buffer
fourstring
2017-10-27 22:21:08 +08:00
火星天气好吗……

( Linux 和 Windows 内存利用机制或者说理念不同。win 是尽量保持闲置内存; Linux 会将闲置内存建立缓存,即 cache 和 buffer 以提高系统运行效率,最大化利用内存)
DoraJDJ
2017-10-27 22:22:35 +08:00
nannanziyu
2017-10-27 22:34:55 +08:00
@fourstring
还说别人火星。。。
都 2017 年了,听说过 superfetch 吗?还 win 是尽量保持闲置内存
wwqgtxx
2017-10-27 22:37:31 +08:00
@nannanziyu 只不过 windows 所有的系统信息 api 默认都不把 cache 内存算成已用内存,所以很多人认为 win 不存在 cache/buffer 内存,其实用任务管理器看看内存那一页就知道 win 也是有很多 cache/buffer 内存的
sw0rd3n
2017-10-27 22:42:30 +08:00
cache buffer
alcarl
2017-10-27 22:51:53 +08:00
@chih buffer 算已使用的
zlfzy
2017-10-27 22:54:42 +08:00
我看你 buffers 占用并不多,重启吧,没有重启解决不了的问题,如果有,那就重启两次
hugee
2017-10-27 22:55:16 +08:00
刚开始用 lin 吧
acgnsstech
2017-10-27 22:57:28 +08:00
free -h
esolve
2017-10-30 16:39:17 +08:00
@hugee 啥时 lin ?
esolve
2017-10-30 16:39:34 +08:00
@chih # free -h
total used free shared buffers cached
Mem: 62G 62G 397M 16K 45M 2.3G
-/+ buffers/cache: 60G 2.7G
Swap: 31G 8.3G 23G

cache 和 buffer 占用也不多啊

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/401363

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX