Linux系统性能分析命令
2013-03-23 20:30
465 查看
性能分析工具
一、CPU性能
# vmstat 2 3 //间隔2秒,输出3次
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 42248 33108 38980 706848 1 1 29 92 253 1 5 7 86 2 0
0 0 42248 33108 38980 706856 0 0 0 16 1012 479 1 1 98 0 0
0 0 42248 33108 38980 706856 0 0 0 16 1012 491 0 2 98 0 0
r应小于系统CPU个数,us+sy<80%; in,cs尽量小
# sar -u 2 3 //间隔2秒,输出3次,-u显示系统所有CPU在采样时间内的负载状态
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
06:30:23 PM CPU %user %nice %system %iowait %steal %idle
06:30:25 PM all 0.00 0.00 1.02 0.00 0.00 98.98
06:30:27 PM all 0.00 0.00 1.02 0.00 0.00 98.98
06:30:29 PM all 2.55 0.00 7.14 0.51 0.00 89.80
Average: all 0.85 0.00 3.06 0.17 0.00 95.93
# sar -P 0 3 5 //-P(大写),0第一颗CPU
二、内存性能
# free -m
total used free shared buffers cached
Mem: 1011 990 20 0 32 709
-/+ buffers/cache: 248 762
Swap: 1992 41 1950
对于应用程序来说,可用内存为762=20(free)+32(buffers)+709(cached)
另,看Swap是否开始使用
# free -m -s 2 //间隔两秒
# watch -n 2 -d free //间隔2秒,-d高亮显示变动
# vmstat 2 3
si、so尽量小,wa参考值20%
# sar -r 2 3 //-r显示内存在采用时间内的使用情况
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
05:18:18 PM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad
05:18:20 PM 18016 1017384 98.26 34072 724404 1997748 42496 2.08 1480
05:18:22 PM 18016 1017384 98.26 34072 724404 1997748 42496 2.08 1480
05:18:24 PM 18016 1017384 98.26 34080 724404 1997748 42496 2.08 1480
Average: 18016 1017384 98.26 34075 724404 1997748 42496 2.08 1480
三、磁盘IO性能
# sar -d 2 2
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
06:40:49 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
06:40:51 PM dev8-0 1.01 0.00 32.32 32.00 0.00 1.00 1.00 0.10
06:40:51 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
06:40:53 PM dev8-0 2.06 0.00 74.23 36.00 0.05 23.75 23.75 4.90
Average: DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
Average: dev8-0 1.53 0.00 53.06 34.67 0.02 16.17 16.17 2.47
rd_sec/s 每秒从设备读取的扇区数(1扇区512字节)
avgrq-sz 平均每次设备I/O操作的数据大小
avgqu-sz 平均I/O队列长度
await 平均每次设备I/O操作的等待时间(毫秒)
svctm 平均每次设备I/O操作的服务时间(毫秒)
%util 一秒中有百分之几的时间用于I/O操作
await值应与svctm接近,无I/O等等
# iostat -d 2 2
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 6.48 57.46 182.37 5483649 17406126
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1.52 0.00 36.55 0 72
# vmstat 2 3
bi+bo参考值1000
一、CPU性能
# vmstat 2 3 //间隔2秒,输出3次
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 42248 33108 38980 706848 1 1 29 92 253 1 5 7 86 2 0
0 0 42248 33108 38980 706856 0 0 0 16 1012 479 1 1 98 0 0
0 0 42248 33108 38980 706856 0 0 0 16 1012 491 0 2 98 0 0
r应小于系统CPU个数,us+sy<80%; in,cs尽量小
# sar -u 2 3 //间隔2秒,输出3次,-u显示系统所有CPU在采样时间内的负载状态
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
06:30:23 PM CPU %user %nice %system %iowait %steal %idle
06:30:25 PM all 0.00 0.00 1.02 0.00 0.00 98.98
06:30:27 PM all 0.00 0.00 1.02 0.00 0.00 98.98
06:30:29 PM all 2.55 0.00 7.14 0.51 0.00 89.80
Average: all 0.85 0.00 3.06 0.17 0.00 95.93
# sar -P 0 3 5 //-P(大写),0第一颗CPU
二、内存性能
# free -m
total used free shared buffers cached
Mem: 1011 990 20 0 32 709
-/+ buffers/cache: 248 762
Swap: 1992 41 1950
对于应用程序来说,可用内存为762=20(free)+32(buffers)+709(cached)
另,看Swap是否开始使用
# free -m -s 2 //间隔两秒
# watch -n 2 -d free //间隔2秒,-d高亮显示变动
# vmstat 2 3
si、so尽量小,wa参考值20%
# sar -r 2 3 //-r显示内存在采用时间内的使用情况
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
05:18:18 PM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad
05:18:20 PM 18016 1017384 98.26 34072 724404 1997748 42496 2.08 1480
05:18:22 PM 18016 1017384 98.26 34072 724404 1997748 42496 2.08 1480
05:18:24 PM 18016 1017384 98.26 34080 724404 1997748 42496 2.08 1480
Average: 18016 1017384 98.26 34075 724404 1997748 42496 2.08 1480
三、磁盘IO性能
# sar -d 2 2
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
06:40:49 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
06:40:51 PM dev8-0 1.01 0.00 32.32 32.00 0.00 1.00 1.00 0.10
06:40:51 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
06:40:53 PM dev8-0 2.06 0.00 74.23 36.00 0.05 23.75 23.75 4.90
Average: DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
Average: dev8-0 1.53 0.00 53.06 34.67 0.02 16.17 16.17 2.47
rd_sec/s 每秒从设备读取的扇区数(1扇区512字节)
avgrq-sz 平均每次设备I/O操作的数据大小
avgqu-sz 平均I/O队列长度
await 平均每次设备I/O操作的等待时间(毫秒)
svctm 平均每次设备I/O操作的服务时间(毫秒)
%util 一秒中有百分之几的时间用于I/O操作
await值应与svctm接近,无I/O等等
# iostat -d 2 2
Linux 2.6.18-8.el5 (localhost.localdomain) 03/23/2013
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 6.48 57.46 182.37 5483649 17406126
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1.52 0.00 36.55 0 72
# vmstat 2 3
bi+bo参考值1000
相关文章推荐
- linux系统性能分析命令ps.pstree及top详解
- linux 系统性能分析常用命令
- Linux系统下常用性能分析工具 top命令详解
- Linux系统性能分析命令一:top
- linux 系统性能分析(top命令)及更准确解读内存的占用率(free命令)
- Linux系统性能分析命令五:pidstat
- Linux系统性能分析命令六:free
- Linux系统性能分析命令四:mpstat
- Linux系统性能分析命令二:vmstat
- Linux系统性能分析命令三:iostat
- Linux--系统性能分析命令备忘
- 【转】Linux系统性能分析命令
- 查看linux服务器配置和TOP命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况。
- 盘点linux系统中的12条性能调优命令。
- linux性能分析命令ps,top,vmstat 使用
- Linux下常用的性能分析工具-top命令
- linux性能分析命令
- linux使用nmon监控、分析系统性能
- linux系统下,c++程序,调用system命令失败,分析过程
- Linux 下使用 NMON 分析系统性能