vmstat

本文详细介绍了vmstat命令的使用方法及各项指标的意义,包括进程状态、内存使用情况、交换分区、输入输出操作、系统调用及CPU使用情况等。通过这些信息可以帮助用户诊断系统的性能瓶颈。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vmstat 

vmstat [delay [count]]

故障:采样间隔平均每秒的捕获和中断率。  

in :设备中断   

sy :系统调用。   

cs :内核线程上下文切换。   

 

Cpu:CPU 使用时间故障百分比。  

us :用户时间。   

sy :系统时间。   

id :CPU 空闲时间。   

wa :CPU 空闲时间,在此期间系统有未完成的磁盘/NFS I/O 请求。

 

[root@r0~]# vmstat 2 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0    104 533320 295120 807088    0    0     1    37    2    3 19  7 73  1  0
 0  0    104 507484 295120 807068    0    0     0   210 1858 7734 23  4 72  0  0
 1  0    104 514488 295120 807096    0    0     0     0 1672  871 10  3 87  0  0

 

一些标准说明:

CPU:

1) 如果(process r)是连续的大于在系统中的CPU的个数表示系统现在运行比较慢,有多数的进程等待CPU.
2) 如果r的输出数大于系统中可用CPU个数的4倍的话,则系统面临着CPU短缺的问题,或者是CPU的速率过低,系统中有多数的进程在等待CPU,造成系统中进程运行过慢.
3) 如果空闲时间(cpu id)持续为0并且系统时间(cpu sy)是用户时间的两倍(cpu us) 系统则面临着CPU资源的短缺.

简单的说就是:

r 和 b 不高于5,如果r 经常大于4,且id 经常少于40,则表示CPU 负荷很重。

us+sy 不超过80%,如果大于80,进程就会在运行队列中花费等待时间,响应时间和吞吐量就会下降。

wa 不超过25, 如果说wa >40表明磁盘io没有也许存在不合理的平衡,或者对磁盘操作比较频繁

 

一般情况下,导致CPU资源不足都是应用程序的问题.比如一些SQL语句不合理等等都会造成这样的现象.

 

 

FIELD DESCRIPTION FOR VM MODE

   Procs

       r: The number of processes waiting for run time.

       b: The number of processes in uninterruptible sleep.

   Memory

       swpd: the amount of virtual memory used.

       free: the amount of idle memory.

       buff: the amount of memory used as buffers.

       cache: the amount of memory used as cache.

       inact: the amount of inactive memory. (-a option)

       active: the amount of active memory. (-a option)

   Swap

       si: Amount of memory swapped in from disk (/s).

       so: Amount of memory swapped to disk (/s).

   IO

       bi: Blocks received from a block device (blocks/s).

       bo: Blocks sent to a block device (blocks/s).

   System

       in: The number of interrupts per second, including the clock.

       cs: The number of context switches per second.

   CPU

       These are percentages of total CPU time.

       us: Time spent running non-kernel code. (user time, including nice time)

       sy: Time spent running kernel code. (system time)

       id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.

       wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero.

 

FIELD DESCRIPTION FOR DISK MODE

   Reads

       total: Total reads completed successfully

       merged: grouped reads (resulting in one I/O)

       sectors: Sectors read successfully

       ms: milliseconds spent reading

   Writes

       total: Total writes completed successfully

       merged: grouped writes (resulting in one I/O)

       sectors: Sectors written successfully

       ms: milliseconds spent writing

   IO

       cur: I/O in progress

       s: seconds spent for I/O

 

FIELD DESCRIPTION FOR DISK PARTITION MODE

       reads: Total number of reads issued to this partition

       read sectors: Total read sectors for partition

       writes : Total number of writes issued to this partition

       requested writes: Total number of write requests made for partition

 

FIELD DESCRIPTION FOR SLAB MODE

       cache: Cache name

       num: Number of currently active objects

       total: Total number of available objects

       size: Size of each object

       pages: Number of pages with at least one active object

       totpages: Total number of allocated pages

       pslab: Number of pages per slab

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值