标签:计算 结果 out linux服务器 buffers share 手动 释放 mem
常用参数演示
[root@ ~]# free -b #以Byte为单位显示
total used free shared buffers cached
Mem: 1044611072 552603648 492007424 57344 39006208 124108800
-/+ buffers/cache: 389488640 655122432
Swap: 1572855808 245936128 1326919680
[root@ ~]# free -k #以KB为单位显示
total used free shared buffers cached
Mem: 1020128 536520 483608 56 38108 121200
-/+ buffers/cache: 377212 642916
Swap: 1535992 240172 1295820
[root@ ~]# free -m #以MB为单位显示
total used free shared buffers cached
Mem: 996 523 472 0 37 118
-/+ buffers/cache: 368 627
Swap: 1499 234 1265
[root@ ~]# free -h #人性化输出显示
total used free shared buffers cached
Mem: 996M 521M 474M 56K 35M 118M
-/+ buffers/cache: 368M 628M
Swap: 1.5G 234M 1.2G
[root@ ~]# free -o #不显示-/+buffers/cache line,不建议
total used free shared buffers cached
Mem: 1020128 536892 483236 56 38468 121284
Swap: 1535992 240172 1295820
[root@ ~]# free -th #算上swap
total used free shared buffers cached
Mem: 996M 524M 471M 56K 37M 118M
-/+ buffers/cache: 368M 627M
Swap: 1.5G 234M 1.2G
Total: 2.4G 758M 1.7G
[root@ ~]# time free -s 1 -c 3 #表示持续每隔1s更新更新一次mem信息,更新3次
total used free shared buffers cached
Mem: 1020128 537512 482616 56 38868 121328
-/+ buffers/cache: 377316 642812
Swap: 1535992 240172 1295820
total used free shared buffers cached
Mem: 1020128 537512 482616 56 38868 121328
-/+ buffers/cache: 377316 642812
Swap: 1535992 240172 1295820
total used free shared buffers cached
Mem: 1020128 537512 482616 56 38868 121328
-/+ buffers/cache: 377316 642812
Swap: 1535992 240172 1295820
real 0m2.002s
user 0m0.000s
sys 0m0.001s
[root@ ~]#
total used free shared buffers cached
Mem: 996M 525M 470M 56K 38M 118M
-/+ buffers/cache: 368M 627M
Swap: 1.5G 234M 1.2G
第一行
buffers/cahed手动释放测试
释放前
[root@ ~]# free -h total used free shared buffers cached Mem: 996M 531M 465M 56K 42M 119M -/+ buffers/cache: 369M 626M Swap: 1.5G 234M 1.2G [root@ ~]#
使用命令手动释放
[root@ ~]# echo 3 > /proc/sys/vm/drop_caches [root@ ~]# free -h total used free shared buffers cached Mem: 996M 391M 604M 56K 420K 26M -/+ buffers/cache: 364M 631M Swap: 1.5G 234M 1.2G [root@ ~]#
手动释放后我们看到 第一行Mem的used和free有了很大的提升,我们上述的观点得到了验证
使用find 命令让buffers增加
[root@ backup]# free -h;find .>/dev/null;free -h total used free shared buffers cached Mem: 996M 397M 598M 56K 2.6M 32M -/+ buffers/cache: 362M 633M Swap: 1.5G 234M 1.2G
total used free shared buffers cached Mem: 996M 415M 581M 56K 17M 32M -/+ buffers/cache: 364M 631M Swap: 1.5G 234M 1.2G [root@ backup]#
使用cat 命令让cached增加
[root@zwj python]# free -h;find /mydata/backup/python/ -type f|xargs cat>/dev/null 2>&1;free -h total used free shared buffers cached Mem: 996M 434M 561M 56K 18M 50M -/+ buffers/cache: 365M 630M Swap: 1.5G 234M 1.2G total used free shared buffers cached Mem: 996M 767M 228M 56K 20M 367M -/+ buffers/cache: 379M 617M Swap: 1.5G 234M 1.2G
Done!!!
使用Free命令查看Linux服务器内存使用状况(-/+ buffers/cache详解)
标签:计算 结果 out linux服务器 buffers share 手动 释放 mem
原文地址:http://www.cnblogs.com/diaosir/p/6912766.html