linux vmstat

An acronym for “Virtual Memory Statistics”, the vmstat command is a Linux utility for displaying statistics related to memory consumption, disk usage, and other system information. Without any further ado, let us get down to the analysis of vmstat command.

vmstat命令是“虚拟内存统计信息”的首字母缩写,是一种Linux实用程序,用于显示与内存消耗,磁盘使用情况和其他系统信息有关的统计信息。 事不宜迟,让我们开始分析vmstat命令。

In case your system does not have the vmstat command, then no worries, as it comes under the package of 'sysstat'.

如果您的系统没有vmstat命令,那么不用担心,因为它在'sysstat'软件包下。

Debian/Ubuntu users can install the package by using the apt command:

Debian / Ubuntu用户可以使用apt命令安装软件包:


sudo apt install sysstat

Whereas other Linux distribution users can install 'sysstat' using their standard installation commands.

其他Linux发行版用户可以使用其标准安装命令来安装'sysstat'

Before moving onto the explanation stuff, we first need to get root access as some information might be off-limits for certain users. This can be done by 'sudo -s' or 'sudo su'.

在继续进行介绍之前,我们首先需要获得root用户访问权限,因为某些信息可能对某些用户不可用。 这可以通过'sudo -s''sudo su'

vmstat命令的基本输出 (Basic output of the vmstat command)

After completing all the obligations required for the setup, let us run 'vmstat' on the terminal.

完成设置所需的所有义务后,让我们在终端上运行'vmstat'

Basic Output
基本输出

At first, the shady output is beyond comprehension for any Linux user. Let us try to cast some light on it. There are six sections in the output, with some non-indented statistics below:

最初,对于任何Linux用户来说,可疑的输出都是无法理解的。 让我们尝试对此有所启发。 输出中有六个部分,下面是一些非缩进的统计信息:

  • procs – Process Statistics

    • r – The number of processes that are active in the system.
    • b – The number of sleeping processes.

    procs –过程统计

    • r –系统中活动进程数。
    • b睡眠 进程数
  • memory – Memory statistics
    • swpd – The amount of virtual memory being used by the system. The swap space is initially unoccupied. but as the system’s physical memory is about the reach its limit, the kernel decides to use the swap partition.
    • free – The amount of free memory.
    • buff – The amount of memory that has been temporarily occupied as buffers.
    • cache – The amount of cache memory.

    内存 –内存统计信息

    • swpd –系统正在使用的虚拟内存量。 交换空间最初未被占用。 但是随着系统的物理内存即将达到其极限,内核决定使用交换分区。
    • free- 可用 内存量。
    • buff –暂时用作缓冲区内存量。
    • cache缓存内存量。
  • swap – Swap space Statistics
    • si – The rate at which memory is swapped in from disk.
    • so – The rate at which memory is swapped out to disk.

    swap –交换空间统计

    • si –从磁盘交换 内存速率
    • 因此内存 换出到磁盘的速率
  • io – Input/Output Statistics
    • bi – The rate at which blocks are read from disk.
    • bo – The rate at which blocks are written to disk.

    io –输入/输出统计

    • bi –从磁盘读取 速率
    • bo –将 写入磁盘的速率
  • system – Scheduling statistics
    • in – The rate of system interrupts.
    • cs – The rate of context switches done by the scheduler.

    系统 –计划统计

    • in系统中断速率
    • cs –调度程序完成上下文切换速率
  • cpu – CPU Statistics
    • us – The percentage of CPU time spent on user processes.
    • sy – The percentage of CPU time spent on kernel processes.
    • id – The percentage of idle CPU time.
    • wa – The percentage of CPU time spent waiting for Input/Output.
    • st – The percentage of CPU time stolen by a virtual machine.

    cpu – CPU统计信息

    • us –在用户进程上花费的CPU时间的百分比。
    • sy –在内核进程上花费的CPU时间的百分比。
    • id空闲CPU时间的百分比。
    • wa –等待输入/输出花费的CPU时间的百分比。
    • st –虚拟机窃取CPU时间的百分比。

The above statistics provided by the basic output are instantaneous, that is, the system information at that particular point of time. To get a timestamp along with the output, we can make use of '-t' option.

基本输出提供的以上统计信息是瞬时的,即该特定时间点的系统信息。 为了获得输出的时间戳,我们可以使用'-t'选项。


vmstat -t
Basic output of the vmstat command with Timestamp
带有时间戳的vmstat命令的基本输出


连续统计输出 (Continuous statistical output)

In order to get a series of 'vmstat' outputs, we need to run the following command:

为了获得一系列的'vmstat'输出,我们需要运行以下命令:


vmstat <DELAY> <ITERATIONS>
Series of ‘vmstat’ outputs
一系列的“ vmstat”输出

This procedure is not very difficult to understand.

这个过程不是很难理解。

  • <DELAY> – Since, 'vmstat' provides discrete values we can specify the delay between each statistic, the command displays.<DELAY> –由于'vmstat'提供离散值,因此我们可以指定每个统计之间的延迟,命令显示。
  • <ITERATIONS> – The number of times we need the command to print the information.<ITERATIONS> –我们需要命令打印信息的次数。

Note: To run the command infinite number of times, (basically an infinite loop), we can omit the <ITERATIONS> parameter.

注意:要无限次运行命令(基本上是无限循环),我们可以省略<ITERATIONS>参数。

For instance, 'vmstat 1' displays statistics with a one-second delay indefinite number of times.

例如, 'vmstat 1'显示具有一秒延迟的统计信息,次数不确定。



内存和调度统计 (Memory and Scheduling Statistics)

We can display some extended information related to Memory, by running:

通过运行以下命令,我们可以显示一些与内存有关的扩展信息:


vmstat -s
Vmstat Memory Stats
Vmstat内存统计信息

These summary statistics are self-explainable.

这些汇总统计数据是不言自明的。

  • The first set of lines deals with the amount of memory being used in the system:

    • Total physical memory
    • Currently used memory
    • Active memory – used recently
    • Inactive memory – not used recently
    • Free memory
    • Buffer memory
    • Cache memory
    • Swap memory information

    第一组行处理系统中使用的内存量:

    • 物理内存
    • 当前使用的内存
    • 活动内存 –最近使用
    • 非活动内存 –最近未使用
    • 可用内存
    • 缓冲存储器
    • 快取记忆体
    • 交换内存信息
  • The following set of lines represents the CPU used in various ways:
    • CPU used for high priority user processes (not-nice)
    • Processor time used for less priority user processes (nice)
    • CPU for kernel processes
    • Idle CPU
    • Processor for input/output management
    • CPU for interrupt requests
    • Processor time used for software interrupts
    • CPU stolen by some virtual machine

    以下几行代表以各种方式使用的CPU:

    • 用于高优先级用户进程的CPU(不错)
    • 优先级较低的用户进程所用的处理器时间(不错)
    • 内核进程的 CPU
    • CPU闲置
    • 输入/输出管理处理器
    • CPU的中断请求
    • 用于软件中断的处理器时间
    • 虚拟机窃取了CPU
  • Next up are values related paging in Operating System:
    • Number of pages paged in from virtual memory
    • The number of pages paged out to virtual memory
    • Number of pages read from swap memory
    • Number of pages written to swap memory

    接下来是与操作系统中的分页有关的值:

    • 虚拟内存中分页页数
    • 分页到虚拟内存的页面
    • 交换内存读取页数
    • 写入交换内存的页数
  • The last set of numbers denote:
    • Number of interrupts since boot-time
    • Number context switches done by the system scheduler
    • The timestamp for the last boot-time
    • The number of forks done to create child processes. (This information can directly be obtained by running 'vmstat -f')

    最后一组数字表示:

    • 自启动以来的中断
    • 系统调度程序完成的上下文切换数量
    • 上次启动时间的时间戳
    • 创建子进程完成的派生数。 (可以通过运行'vmstat -f'直接获得此信息)


使用vmstat命令显示磁盘统计信息 (Display Disk Statistics Using vmstat Command)

The command provides a similar kind of statistics for disk usage. It can be accessed by:

该命令为磁盘使用情况提供了类似的统计信息。 可以通过以下方式访问它:


vmstat -D
Disk statistics using ‘vmstat’
使用'vmstat'的磁盘统计信息

Each entry displays some crucial information:

每个条目显示一些关键信息:

  • The number of disks present in the system.系统中存在的磁盘数
  • The number of partitions in the system.系统中的分区数
  • The total number of requested reads.的请求总数 读取
  • The number of merged reads for increasing performance.合并读取的数量以提高性能。
  • The number of sectors already read from the disk.已从磁盘读取的扇区数
  • The period of time spent on reading the disk in milliseconds.读取磁盘所花费时间(以毫秒为单位)。
  • The total number of requested writes.总数要求的。
  • The number of merged writes for increasing performance.合并写入的数量以提高性能。
  • The number of sectors already written to the disk.已经写入磁盘的扇区数
  • The period of time spent on writing to the disk in milliseconds.写入磁盘所花费时间(以毫秒为单位)。
  • The number of Input/Output currently inprogress.当前正在进行Input / Output数。
  • The period of time spent waiting for Input/Output.等待 Input / Output所 花费时间

Note: In certain versions of 'vmstat', the last two entries in the above output have been implemented incorrectly.

注意:在某些版本的'vmstat' ,上面输出中的最后两个条目是 实施不正确。

For detailed statistics on each disk usage, we can use '-d' option.

有关每个磁盘使用情况的详细统计信息,我们可以使用'-d'选项。


vmstat -d
Detailed disk statistics
详细的磁盘统计信息

The above output displays the same statistics for every specific disk present in the system.

上面的输出为系统中存在的每个特定磁盘显示相同的统计信息。



Linux内核的内存使用情况 (Memory usage by Linux kernel)

Linux kernel implements a slab-level of memory management, for efficient use of memory in the system. The vmstat command provides information related to slabs maintained by the Linux kernel.

Linux内核实现了平板级的内存管理,以有效使用系统中的内存。 vmstat命令提供与Linux内核维护的平板有关的信息。

This sort of output can be obtained by:

可以通过以下方式获得此类输出:


vmstat -m
Slabs in Memory Management
内存管理板

The columns in the output means:

输出中的列表示:

  • The first column denotes the name of the slab (Cache).第一列表示平板名称 (缓存)。
  • It is followed by the number of objects currently held in the slab (Num).其次是平板中当前 保存 的对象数 (数字)。
  • Next up, is the total number of available objects present in the slab (Total).接下来,是平板中存在的可用对象总数(总计)。
  • The next value is the size of the slab in bytes (Size).下一个值是平板大小(以字节为单位)(大小)。
  • The last value is the number of pages present in each slab (Pages).的最后一个值存在于每个板坯(页数)的页面数量

This pretty much sums up the important information presented by the 'vmstat' command.

这几乎总结了'vmstat'命令提供的重要信息。



结论 (Conclusion)

This concludes the guide to the usage of 'vmstat' command in Linux. In case, you are curious about some specifications of the command, then the manual pages will be the right path to follow.

总结了Linux中'vmstat'命令用法的指南。 如果您对命令的某些说明感到好奇,那么手册页将是正确的选择。

The manual pages can be accessed by running 'man vmstat' on the terminal. We hope this article provided enough information to the reader.

可以通过在终端上运行'man vmstat'来访问手册页。 我们希望本文能为读者提供足够的信息。

翻译自: https://www.journaldev.com/42125/vmstat-command-in-linux

linux vmstat

linux vmstat_Linux中vmstat命令指南相关推荐

  1. mysql隐藏密码_MySQL在Linux系统中隐藏命令行中的密码的方法

    在命令行中输入命令并不是一个好主意,会造成安全问题.但是如果你决定去写一个应用,而这个应用需要在命令行中使用密码或者其他敏感信息.那么,你能通过以下方法禁止系统的其他用户轻易的看到这些敏感数据 呢?, ...

  2. linux shell中的命令自动补全(compgen complete)与 命令行参数解析

    linux shell中的命令自动补全(compgen complete)与 命令行参数解析 标签: shell脚本 2013-12-31 21:56 6661人阅读 评论(6) 收藏 举报 分类: ...

  3. head在linux命令中什么意思,linux系统中head命令使用说明

    linux系统中head命令使用说明 head 与 tail 就像它的名字一样的'浅显易懂,它是用来显示开头或结尾某个数量的文字区块,head 用来显示档案的开头至标准输出中,而 tail 想当然尔就 ...

  4. find linux 目录深度_浪里淘沙,详解Linux系统中Find命令的实用技巧

    知了小巷:浪里淘沙,详解Linux系统中Find命令的实用技巧. 啊哈,找到了! 当我们需要在Linux系统上定位某个文件或目录时,find命令通常是必备之选. 它使用起来非常简单,但有许多不同的可选 ...

  5. linux系统中scp命令的用法

    scp是 secure copy的缩写, scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令.linux的scp命令可以在linux服务器之间复制文件和目录. scp命令的用处: scp ...

  6. linux 查找只读文件夹,Linux系统中查找命令find的使用方法(二)

    今天达内Linux培训小编要继续跟大家分享关于Linux系统中中查找命令find的使用方法的文章.在上文中小编提到,Linux查找命令是Linux系统中很重要也是很常用的命令之一.Linux的查找命令 ...

  7. linux系统里route -n不起作用,Linux系统中traceroute命令使用详解

    Linux系统中traceroute命令可以追踪到网络数据包的路由途径.下面由学习啦小编为大家整理了linux系统中traceroute命令使用详解,希望对大家有帮助! Linux系统中tracero ...

  8. linux系统中find怎么用,Linux系统中查找命令find的使用方法(一)

    今天达内Linux培训小编要跟大家分享的文章是关于Linux系统中中查找命令find的使用方法.熟悉Linux系统的小伙伴们都知道,Linux查找命令是Linux系统中很重要也是很常用的命令之一.Li ...

  9. Linux系统中常用命令行命令、快捷键、创建长路径的快捷键

    Linux系统中常用命令行命令.快捷键.创建长路径的快捷键 1.常用Linux命令: 1.1 文件和目录: cd /home 进入 '/home' 目录 cd - 返回上一级目录 cd -/- 返回上 ...

最新文章

  1. 在Docker里使用(支持镜像继承的)supervisor管理进程(转)
  2. 如何在Epower工作流平台(企业流程管理平台)上建立OA系统
  3. 架构师养成之道-01-知识图谱
  4. php和html和javascript,php和javascript区别有哪些
  5. Linux下卸载vmware
  6. 三刺激值计算公式_常用的车削、铣削和钻削计算公式,转走不谢
  7. linux系统下如何优化mysql运行环境
  8. 利用计算机对调查问卷进行,关于电脑需求调查问卷
  9. 学习笔记:GAMES101图形学入门闫令琪(五)抗锯齿
  10. 如何用css绘制一个三角形
  11. Educational Codeforces Round 91 D. Berserk And Fireball
  12. 基于Kinect Azure的多相机数据采集(一)
  13. 软件测试个人能力提升,软件测试人员提升测试技能的10个妙招分享
  14. ORA-31655,ORA-39154 Objects from foreign schemas have been removed from import
  15. 微信小程序 新版canvas绘制图片方法
  16. CSDN写文章MarkDown用到的表情包收集(转自Github)
  17. 我的游戏学习日志10——数字游戏策划(5)游戏策划的概念与分工
  18. 朗润外盘国际期货:ChatGPT这个人工智能有点东西
  19. Lecture2:损失函数及优化
  20. 数据库备份-XtraBackup

热门文章

  1. Hadoop/HBase 配置snappy压缩
  2. sp_executesql (Transact-SQL) from MSDN
  3. 健康窈窕美女第一课 减肥vs早餐四个关键问题。
  4. Visual Studio 2010 中编写C代码的一些常见问题
  5. [转载] pip快速下载python包
  6. [转载] Python字典按照keys排序输出为列表
  7. [转载] Python学习之Numpy
  8. [转载] numpy教程:矩阵matrix及其运算
  9. PMP学习系列5:PMBOK(5th)第三章-项目管理过程
  10. AJAX通过HTML请求C#一般处理程序