Linux top command illustration

1. 关于CPU的wa, si, hi, 理想系统的wa应该为0%, si, hi 应小于5%.

wa高说明系统等待IO的时间长,例如:http://hi.baidu.com/higkoo/item/70600834426247483075a1df 


2. 关于block和cache的区别和联系,下面是几个小实验的测试结果,测试机器内存约50G。

1.    cat /dev/vg00/lvol8 >/dev/null

buffers increased about 10G, while cached doesn’t change.

 

2.    cat /dev/vg00/lvol8 >/dev/null (again)

buffers and cached doesn’t change

 

3.    dd if=/dev/zero of=test.data bs=10M count=1000

cached increased about 10G, while buffers doesn’t change.

 

4.    cp test.data test.1

cached increased another 10G, while buffers doesn’t change.

 

5.    rm test.1

cached decreased about 10G and free memory increased 10G.

 

6.    cat bigfile.txt >/dev/null

cached increased about 1G (size of bigfile).


使用free命令也可以看到内存的使用情况,

>>dd if=/dev/zero of=data.dat bs=10M count=500

root@server:/home/nomad2# free -m
             total       used       free     shared    buffers     cached
Mem:           496        487          8          0          7        196
-/+ buffers/cache:        284        212
Swap:         9554       1081       8472
root@server:/home/nomad2# swapon data.dat 
root@server:/home/nomad2# free -m
             total       used       free     shared    buffers     cached
Mem:           496        490          6          0          7        196
-/+ buffers/cache:        286        209
Swap:        14554       1081      13472
root@server:/home/nomad2# swapon -s 
Filename                                Type            Size    Used    Priority
/dev/sda3                               partition       9783576 1107248 -1
/home/nomad2/data.dat                 file            5119992 0       -2
root@server:/home/nomad2# swapoff data.dat 
root@server:/home/nomad2# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda3                               partition       9783576 1107248 -1


3.  Buffers and Cached is part of used.

top - 13:43:31 up 8 days, 56 min,  4 users,  load average: 0.23, 0.26, 0.25

Tasks: 560 total,   1 running, 559 sleeping,   0 stopped,   0 zombie

Cpu(s):  0.2%us,  0.1%sy,  0.0%ni, 99.5%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%st

Mem:  49453940k total, 39928308k used,  9525632k free, 23303928k buffers

Swap:  8191992k total,   226180k used,  7965812k free, 5293240k cached


Refer to:

http://soft.zdnet.com.cn/software_zone/2007/1006/536692.shtml

http://unix.stackexchange.com/questions/14102/real-memory-usage

http://blog.unixy.net/2009/07/flush-buffers-and-cache-on-linux/

http://go2linux.garron.me/linux/2011/01/how-clear-or-drop-cache-buffer-pages-linux-memory-880

http://www.commandlinefu.com/commands/view/1026/empty-the-linux-buffer-cache

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值