Linux Performance Monitoring Commands

Reference

[1] http://www.thegeekstuff.com/2011/07/iostat-vmstat-mpstat-examples/?utm_source=feedburner

[2] https://www.computerhope.com/unix/iostat.htm

[3] https://www.lifewire.com/linux-system-running-uptime-3867758

uptime and w report how long the system has been running and the load average

iostat reports CPU, disk I/O, and NFS statistics.

vmstat reports virtual memory statistics.

mpstat reports processors statistics

uptime

[email protected]7010:~$ uptime

11:07:59 up 9 days, 18:46,  1 user,  load average: 0.23, 0.51, 0.59

The default output for the uptime command is as follows:

  • The current time
  • How long the system has been running
  • How many users are logged in
  • The load average for the past 1, 5 and 15 minutes

The load averages show the average number of processes that are in a runnable or uninterruptable state.

w

[email protected]7010:~$ w

11:10:16 up 9 days, 18:48,  1 user,  load average: 1.17, 0.64, 0.62

USER     TTY      FROM             [email protected]   IDLE   JCPU   PCPU WHAT

chizhang tty7     :0               16Jun17  9days  2:09m  0.46s /sbin/upstart --user 

The output from the w command is as follows:

  • user
  • tty
  • from
  • login time
  • idle time
  • JCPU
  • PCPU
  • WHAT

The w command shows more than just the current uptime. It shows who is logged in and what they are currently doing.

The JCPU is the time used by all processes attached to the terminal and the PCPU shows the time used by the current process in the WHAT column.

iostat

The iostat command generates three types of reports: the CPU Utilization report, the Device Utilization report and the Network Filesystem report.

[email protected]7010:~$ iostat
Linux 4.4.0-79-generic (chizhang-OptiPlex-7010)     26/06/17     _x86_64_    (8 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.47    0.00    0.43    0.02    0.00   98.07

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               4.20        19.48       233.88   16478613  197805752

CPU Utilization Report


%user


Show the percentage of CPU utilization that occurred while executing at the user (application) level.


%nice


Show the percentage of CPU utilization that occurred while executing at the user level with nicepriority.


%system


Show the percentage of CPU utilization that occurred while executing at the system (kernel) level.


%iowait


Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.


%steal


Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.


%idle


Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.

Device Utilization Report


Device


This column gives the device (or partition) name as listed in the /dev directory.


tps


Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the device. Multiple logical requests can be combined into a single I/O request to the device. A transfer is of indeterminate size.


Blk_read/s (kB_read/s, MB_read/s)


Indicate the amount of data read from the device expressed in a number of blocks (kilobytesmegabytes) per second. Blocks are equivalent to sectors and therefore have a size of 512 bytes.


Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s)


Indicate the amount of data written to the device expressed in a number of blocks (kilobytes, megabytes) per second.


Blk_read (kB_read, MB_read)


The total number of blocks (kilobytes, megabytes) read.


Blk_wrtn (kB_wrtn, MB_wrtn)


The total number of blocks (kilobytes, megabytes) written.


rrqm/s


The number of read requests merged per second that were queued to the device.


wrqm/s


The number of write requests merged per second that were queued to the device.


r/s


The number (after merges) of read requests completed per second for the device.


w/s


The number (after merges) of write requests completed per second for the device.


rsec/s (rkB/s, rMB/s)


The number of sectors (kilobytes, megabytes) read from the device per second.


wsec/s (wkB/s, wMB/s)


The number of sectors (kilobytes, megabytes) written to the device per second.


avgrq-sz


The average size (in sectors) of the requests that were issued to the device.


avgqu-sz


The average queue length of the requests that were issued to the device.


await


The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.


r_await


The average time (in milliseconds) for read requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.


w_await


The average time (in milliseconds) for write requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.


svctm


The average service time (in milliseconds) for I/O requests that were issued to the device. Warning! Do not trust this field anymore! This field will be removed in a future sysstat version.


%util


Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.

vmstat

vmstat reports virtual memory statistics and is used to help identify performance bottlenecks.

vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity.

The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case.

[email protected]7010:~$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 685260 986196 570376 3263248    0    0     2    13    2    5  1  0 98  0  0

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 (per second).
so Amount of memory swapped to disk (per second).

IO:

bi Blocks received from a block device (blocks per second).
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: (values expressed in percentages of 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, included in idle.
st Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

mpstat

Using mpstat command without any option, will display the Global Average Activities by All CPUs.

[email protected]7010:~$ mpstat

Linux 4.4.0-79-generic (chizhang-OptiPlex-7010) 26/06/17 _x86_64_ (8 CPU)

11:24:10     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle

11:24:10     all    1.47    0.00    0.43    0.02    0.00    0.00    0.00    0.00    0.00   98.07

Using mpstat with option ‘-P‘ (Indicate Processor Number) and ‘ALL’, will display statistics about all CPUs one by one starting from 0. 0 will the first one.

[email protected]7010:~$ mpstat -P ALL

Linux 4.4.0-79-generic (chizhang-OptiPlex-7010) 26/06/17 _x86_64_ (8 CPU)

11:24:36     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle

11:24:36     all    1.47    0.00    0.43    0.02    0.00    0.00    0.00    0.00    0.00   98.07

11:24:36       0    1.88    0.00    0.63    0.00    0.00    0.00    0.00    0.00    0.00   97.49

11:24:36       1    1.93    0.01    0.61    0.15    0.00    0.00    0.00    0.00    0.00   97.30

11:24:36       2    1.87    0.00    0.61    0.01    0.00    0.01    0.00    0.00    0.00   97.50

11:24:36       3    1.84    0.00    0.78    0.01    0.00    0.00    0.00    0.00    0.00   97.37

11:24:36       4    1.09    0.00    0.19    0.00    0.00    0.00    0.00    0.00    0.00   98.72

11:24:36       5    1.08    0.00    0.18    0.00    0.00    0.00    0.00    0.00    0.00   98.73

11:24:36       6    1.08    0.00    0.18    0.00    0.00    0.00    0.00    0.00    0.00   98.74

11:24:36       7    1.02    0.00    0.28    0.00    0.00    0.00    0.00    0.00    0.00   98.69
时间: 2024-10-11 13:36:40

Linux Performance Monitoring Commands的相关文章

PostgreSQL Performance Monitoring Tools

PostgreSQL Performance Monitoring Tools https://github.com/CloudServer/postgresql-perf-tools This package includes three useful scripts aimed to help to pinpoint performance issues on systems with PostgreSQL as database backend. All scritps are writt

[转帖]How use Nmon and "Java Nmon Analyzer" for Monitor Linux Performance

How use Nmon and "Java Nmon Analyzer" for Monitor Linux Performance https://linoxide.com/monitoring-2/install-nmon-monitor-linux-performance/ Updated May 9, 2018By Pungki AriantoMONITORING, OPEN SOURCE TOOLS Nmon is a  resource monitoring tools

linux Performance tools

废话不说首先看图,这是摘自以为大神的ppt,原文在这里 http://www.brendangregg.com/Slides/SCaLE_Linux_Performance2013.pdf 准备把上面列举出来的图片挨个写blog 分享一下,哦也 linux Performance tools,码迷,mamicode.com

【官方博客】StrictMode API for Built-In Performance Monitoring

http://android-developers.blogspot.com/2010/12/new-gingerbread-api-strictmode.html StrictMode API for Built-In Performance Monitoring [This post is by Brad Fitzpatrick, an Android Software Engineer who worries unreasonably about responsiveness. —Tim

Linux Performance Analysis and Tools(Linux性能分析和工具)

首先来看一张图: 上面这张神一样的图出自国外一个Lead Performance Engineer(Brendan Gregg)的一次分享,几乎涵盖了一个系统的方方面面,任何人,如果没有完善的计算系统知识,网络知识和操作系统的知识,这张图中列出的工具,是不可能全部掌握的. 出于本人对linux系统的极大兴趣,以及对底层知识的强烈渴望,并作为检验自己基础知识的一个指标,我决定将这里的所有工具学习一遍(时间不限),这篇文章将作为我学习这些工具的学习笔记.尽量组织得方便自己日后查阅,并希望对别人也有一

linux memory release commands内存清理/释放命令

linux 内存清理/释放命令 You could find reference from here: http://jingyan.baidu.com/article/597a06436a687f312b5243f3.html Basically it looks like this: ---------------------------------- 清理前内存使用情况 free –m 或者 free 清理内存 echo 1 > /proc/sys/vm/drop_caches 清理后内存

Linux Performance Tunnel

process:一个独立运行的单位 资源:CPU资源,内存资源 CPU: 时间:切片 缓存:缓存当前程序的数据 内存: 空间:映射 线性地址 <---- 物理地址 线性地址:进程运行时认为自己可使用的空间 物理地址:实际内存的空间 进程描述符: 进程元数据 通过一个双向链表(C语言中的struct)描述 Linux:抢占 系统时钟:时钟 tick:滴答 时间解析度 进程类别: 交互式进程:I/O密集型 批处理进程:CPU密集型 实时(Real-time)进程 CPU密集型:时间片长,优先级低 I

linux 性能调优工具参考 (linux performance tools)

之前发现几张图对于linux使用者有着较强的参考意义,下面对其进行简单备忘: # linux 静态信息查看工具 # linux 性能测试工具 benchmark # linux 性能观测工具 # linux 性能调优工具  资源来源链接:http://www.brendangregg.com/linuxperf.html 保持更新,其中不少工具都有使用过,欢迎大家留言交流:更多内容请关注 cnblogs.com/xuyaowen; 原文地址:https://www.cnblogs.com/xuy

Network subsystem Of Linux Performance and Tuning Guidelines