日期:2014-05-16  浏览次数:20612 次

linux内存管理命令

vmstat -s

与free -m?是比较好的观测内存的命令

?

刚进入运行的系统

-bash-3.2$ vmstat -s
???? 30897940? total memory
?????? 184408? used memory
??????? 78848? active memory
??????? 67432? inactive memory
???? 30713532? free memory
???????? 6356? buffer memory
?????? 105176? swap cache
????? 4192956? total swap
??????????? 0? used swap
????? 4192956? free swap
????????? 369 non-nice user cpu ticks
??????????? 0 nice user cpu ticks
????????? 537 system cpu ticks
?????? 120270 idle cpu ticks
???????? 1523 IO-wait cpu ticks
??????????? 4 IRQ cpu ticks
?????????? 50 softirq cpu ticks
??????????? 0 stolen cpu ticks
?????? 112896 pages paged in
???????? 9724 pages paged out
??????????? 0 pages swapped in
??????????? 0 pages swapped out
?????? 160886 interrupts
??????? 71964 CPU context switches
?? 1350373112 boot time
???????? 2821 forks


[root@localhost ~]# free -m
???????????? total?????? used?????? free???? shared??? buffers???? cached
Mem:???????? 30173??????? 179????? 29994????????? 0????????? 6??????? 102
-/+ buffers/cache:???????? 70????? 30103
Swap:???????? 4094????????? 0?????? 4094

?

?

==========

?

运行很长时间,内存cach了很多

?

?

[root@localhost ssh]# vmstat -a 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
?r? b?? swpd?? free? inact active?? si?? so??? bi??? bo?? in?? cs us sy id wa st
?0? 0????? 0 23590020 5347780 1614948??? 0??? 0???? 0???? 1??? 1??? 0? 0? 0 100? 0? 0
?0? 0????? 0 23590020 5347772 1615016??? 0??? 0???? 0???? 4 1006? 306? 0? 0 100? 0? 0
?0? 0????? 0 23590020 5347772 1615012??? 0??? 0???? 0???? 0 1002? 301? 0? 0 100? 0? 0
?0? 0????? 0 23589880 5347772 1615012??? 0??? 0???? 0??? 24 1017? 384? 0? 0 100? 0? 0


root@localhost ssh]# vmstat -s
???? 30897940? total memory
????? 7302736? used memory
????? 1610636? active memory
????? 5346844? inactive memory
???? 23595204? free memory
?????? 274844? buffer memory
????? 6102092? swap cache
????? 4192956? total swap
??????????? 0? used swap
????? 4192956? free swap
?????? 558515 non-nice user cpu ticks
???????? 1193 nice user cpu ticks
?????? 585088 system cpu ticks
?? 2967723549 idle cpu ticks
?????? 210472 IO-wait cpu ticks
???????? 4406 IRQ cpu ticks
?????? 301885 softirq cpu ticks
??????????? 0 stolen cpu ticks
?????? 543204 pages paged in
???? 41063536 pages paged out
??????????? 0 pages swapped in
??????????? 0 pages swapped out
?? 3722943494 interrupts
??? 393601166 CPU context switches
?? 1346660283 boot time
????? 8934193 forks



[root@localhost ssh]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
?r? b?? swpd?? free?? buff? cache?? si?? so??? bi??? bo?? in?? cs us sy id wa st
?0? 0????? 0 23595204 274848 6102060??? 0??? 0???? 0???? 1??? 1??? 0? 0? 0 100? 0? 0




[root@localhost ssh]# free -m
???????????? total?????? used?????? free???? shared??? buffers???? cached
Mem:???????? 30173?????? 7131????? 23042????????? 0??????? 268?????? 5958
-/+ buffers/cache:??????? 904????? 29269
Swap:???????? 4094????????? 0?????? 4094

?

?