1.cat /proc/loadavg
得到:
1.88 1.57 1.47 5/469 18927
前面三个数据是load avg,是取前1,5,15的数据(与uptime,w的数据一样),代表内核中状态为R(Running)和D(Disk IO)的job平均值,如果有4个cpu,均值如果是1基本表示是使用率为25%.第四个数字表示内核正在运行的进程或线程数量(应少于等于CPU数),第五个表示进程或线程总数,最后一个表示最近创建的进程id.
2.uptime
除了包含load average数据外,还有启动多久,几个用户等。
3.free/vmstat
两个命令主要用来看内存使用,需要区分buffer和cache.在网上找了一些文章,发现最靠谱的解释是:
Buffers are associated with a specific block device, and cover caching of filesystem metadata as well as tracking in-flight pages. The cache only contains parked file data. That is, the buffers remember what's in directories, what file permissions are, and keep track of what memory is being written from or read to for a particular block device. The cache only contains the contents of the files themselves.
cache是页缓存(page cache),buffer是块设备上的file metadata以及记录读写的页缓存位置等。buffer一般不占用太多,不是重要指标,cache才是。
主要用来看内存:
清空页缓存(Linux 2.6之后才支持):
sync # 清空dirty
echo 3 > /proc/sys/vm/drop_caches
4.IO:
sar命令或iostat命令
iostat中nice表示进程带nice标志的用户时间占总的时间的比率。steal还不知道是什么。
带以下参数,详细而且方便时候抽样统计:
iostat interval 3 -t -d -x
如何判断io的bottlenecks,参考:http://oplinux.com/order/iostat.html
参考:
man proc
man uptime
http://qa.blog.163.com/blog/static/190147002201111282625762/
http://stackoverflow.com/questions/6345020/linux-memory-buffer-vs-cache
http://blog.csdn.net/codestinity/article/details/7496962
man iostat