背景最近看到了很多linux命令。 虽然我不太清楚那个参数,但是即使一个一个地说明,也不太明白具体的意思。 遇到这种情况时,往往会询问女儿,检索到的文章对一些具体参数解释不一,自己写一系列文章单独记录,以便日后查阅。 以下从vmstat开始
vmstat角色vmstat命令是最常用的Linux/Unix监视工具,属于sysstat包。 使用此命令可以检查服务器处理器、内存、交换分区、系统IO、系统信息和cpu的使用情况,并解决系统性能问题。
vmstat参数说明使用man vmstat显示命令的帮助信息
[root@cluster ~]# man vmstat
Procs
r :随机处理(runningorwaitingforruntime )。
B : thenumberofprocessesinuninterruptiblesleep。
说明:
r表示可以运行的进程数,如果r参数值过大,则表示CPU繁忙
表示(b )等I ) o的进程数,如果此值过大,则I/O ) )磁盘I/O、网络I )可能存在问题
Memory
SPD : theamountofvirtualmemoryused。
free: the amount of idle memory。
buff : theamountofmemoryusedasbuffers。
cache : theamountofmemoryusedascache
in act : theamountofinactivememory.(-a option ) )。
active : theamountofactivememory.(-a option )
说明:
SWPD表示虚拟内存使用情况,默认大小为k
FREE :表示可用内存的大小,默认大小为k
BUFF表示缓冲区的大小,默认大小为k
che表示缓存的大小,缓存文件和目录信息,并允许快速访问文件和目录。 默认大小为k
INACT:表示非活动的内存大小,默认大小为k
ACTIVE :表示活动内存大小,默认大小为k
Swap
si :多功能磁盘(/s )。
so : amountofmemoryswappedtodisk (/s )
说明:
SI )从从磁盘读取数据到交换分区大小为止,每秒读取多少k
SO:从交换分区写入磁盘大小,每秒写入多少k
如果这两个参数有值,则表示物理内存可能不足,必须使用交换分区来存储数据。
IO
bi :块解密框架设备(blocks/s )。
bo :块ssenttoablockdevice (块/s )。
说明:
BI:从块设备(磁盘)接收的数据块的块大小是多少
BO:要发送到块设备(磁盘)的数据块
System
in : thenumberofinterruptspersecond,including the clock。
cs : thenumberofcontextswitchespersecond。
说明:
IN:系统每秒包含时钟中断的中断数
CS :系统每秒发生的上下文切换数
CPU
thesearepercentagesoftotalcputime。
us : timespentrunningnon-kernel code.((usertime,including nice time ) ) )。
sy : timespentrunningkernelcode.(system time )
id : time spent idle.priortolinux2.5. 41,this includes IO-wait time。
wa : timespentwaitingforio.priortolinux2.5. 41,included in idle。
ST : timestolenfromavirtualmachine.priortolinux2.6. 11,unknown。
说明:
US )非内核代码所消耗的CPU时间通常是用户进程所消耗的CPU时间
SY:内核消耗的CPU时间通常是系统进程
典型US SY ID=100,包括(ID )空闲时间,I ) o等待时间
wa :等待io消费的时间。 如果此值很长,则io可能处于瓶颈状态。
ST :虚拟机的消耗时间。
[root@cluster ~]# vmstat 2 50
procs-------memory-----swap-----io---- system---- system
rbswpdfreebuffcachesisobiboincsussyidwast
1 0 264 142858048 385512 55297228 0 0 240 60 0 0 1 0 99 0 0
2 0 264 142859840 385512 55297036 0 0 364 7271 7329 13674 0 0 100 0 0
3 0 264 142860256 385512 55297064 0 0 188 4637 6531 11489 0 0 100 0 0
1 0 264 142861168 385512 55297204 0 0 104 950 5515 9293 0 0 100 0 0
1 0 264 142861664 385512 55297204 0 0 244 3848 5772 10855 0 0 100 0 0
知识1、查看vmstat命令属于哪一个安装包
[root@ ~]# yum provides vmstat
加载插件:快速镜像,语言包
repodataisover2weeks old.install yum-cron? Or run: yum makecache fast
determining快速镜像
data/file lists _ db|7.1 MB 00336000336000
procps-ng-3.3.10-23.el7.I 6863360 systemandprocessmonitoringutilities
repo :数据
匹配来自:
Filename : /usr/bin/vmstat
procps-ng-3.3.10-23.el7.x86 _ 64: systemandprocessmonitoringutilities
repo :数据
匹配来自:
Filename : /usr/bin/vmstat
procps-ng-3.3.10-17.el7.x86 _ 64: systemandprocessmonitoringutilities
Repo : @anaconda
匹配来自:
Filename : /usr/bin/vmstat
[root@cluster-10-176-50-29 ~]# rpm -qf /usr/bin/vmstat
procps-ng-3.3.10-17.el7.x86_64
2、查看设备数据块大小的几种方式
方法1 :
fdisk-l/dev/sdb|grep-I‘I/o’
方法二:
stat /dev/sdb
方法3
tune 2fs-l/dev/sdb|grep-I“block size”
方法4
blockdev --getbsz /dev/sdb
描述: tune2fs可以查看raid策略,而blockdev可以设置块大小。
3、什么是uninterruptible sleep?