solaris查看I/O、内存、网络性能优化命令 iostat , vmstat

iostat反映了终端、磁盘I/O情况和CPU活动。输出结果的第一行是从系统启动到现在为止的这段时间的结果,接下去的每一行是interval时间段内的结果。Kernel里有一组计数器用来跟踪这些值。
iostat的默认参数是tdc(terminal, disk, and CPU)。如果任何其他的选项被指定,这个默认参数将被完全替代,例如,iostat -d将只反映磁盘的统计结果。

基本语法: iostat interval count

option - 让你指定所需信息的设备,像磁盘、cpu或者终端(-d , -c , -t or -tdc ) 。x 选项给出了完整的统计结果(gives the extended statistic)。
interval - 在两个samples之间的时间(秒)。
count - 就是需要统计几次

示例:

# iostat -xd
                 extended device statistics                
device    r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b
sd0       0.2    0.0    3.8    0.1  0.0  0.0    4.3   0   0
sd1       0.0    0.0    0.6    0.0  0.0  0.0   47.0   0   0
sd2       0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
sd3       0.0    0.0    0.6    0.0  0.0  0.0   46.9   0   0
sd4       0.1   63.3    0.6 2538.6 119.4  1.6 1909.8  53  53
ssd2      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd3      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd8      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd11     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd16    40.4   49.5 5139.9 4667.4  0.0  1.1   12.8   0   8
ssd17     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd20     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd21     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd22   211.3   45.6 26994.2 3818.7  0.0  3.6   14.0   0  30
ssd23   211.3   45.5 26992.8 3818.9  0.0  3.6   14.0   0  30

# iostat -xtc 5 2
                 extended device statistics                    tty         cpu
device    r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b  tin tout  us sy wt id
sd0       0.2    0.0    3.8    0.1  0.0  0.0    4.3   0   0   17  574   1  1  0 97
sd1       0.0    0.0    0.6    0.0  0.0  0.0   47.0   0   0
sd2       0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
sd3       0.0    0.0    0.6    0.0  0.0  0.0   46.9   0   0
sd4       0.1   63.3    0.6 2539.9 119.4  1.6 1910.3  53  53
ssd2      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd3      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd8      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd11     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd16    40.4   49.5 5139.6 4667.2  0.0  1.1   12.8   0   8
ssd17     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd20     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd21     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd22   211.3   45.6 26993.4 3818.6  0.0  3.6   14.0   0  30
ssd23   211.3   45.4 26992.0 3818.8  0.0  3.6   14.0   0  30
                 extended device statistics                    tty         cpu
device    r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b  tin tout  us sy wt id
sd0       0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0   42  271   4  1  0 95
sd1       0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
sd2       0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
sd3       0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
sd4       0.0  121.5    0.0 4855.4 291.9  3.0 2426.1 100 100
ssd2      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd3      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd8      0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd11     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd16     0.0   44.1    0.0  635.6  0.0  0.1    1.2   0   1
ssd17     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd20     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd21     0.0    0.0    0.0    0.0  0.0  0.0    0.0   0   0
ssd22    80.7    0.0 10265.4    0.0  0.0  1.1   13.8   0   6
ssd23    75.6    0.0 9657.1    0.0  0.0  1.1   15.1   0   6

disk name of the disk
r/s reads per second
w/s writes per second
Kr/s kilobytes read per second
Kw/s kilobytes written per second
wait average number of transactions waiting for service (Q length)
actv average number of transactions actively
being serviced (removed from the
queue but not yet
completed)
%w percent of time there are transactions waiting
for service (queue non-empty)
%b percent of time the disk is busy (transactions
in progress)

从iostat输出结果中需要注意的值:

Reads/writes per second (r/s , w/s)
Percentage busy (%b)
Service time (svc_t)

如果磁盘显示长时间的高reads/writes,并且磁盘的percentage busy (%b)也远大于5%,同时average service time (svc_t)也远大于30 milliseconds,这以下的措施需要被执行:
1.)调整应用,令其使用磁盘i/o更加有效率,可以通过修改磁盘队列、使用应用服务器的cache

2.)将文件系统分布到2个或多个磁盘上,并使用volume manager/disksuite的条带化特点

3.) 增加系统参数值,如inode cache , ufs_ninode。Increase the system parameter values for inode cache , ufs_ninode , which is Number of inodes to be held in memory. Inodes are cached globally (for UFS), not on a per-file system basis

4.) 将文件系统移到更快的磁盘/控制器,或者用更好的设备来代替 

Virtual Memory Statistics ( vmstat )

vmstat - vmstat反映了进程的虚拟内存、虚拟内存、磁盘、trap(是不是翻译成中断??)和cpu的活动情况

在多cpu系统中,vmstat在输出结果中平均了cpu数量。For per-process statistics .如果没有选项,vmstat显示一行虚拟内存活动的概要 

 语法:

vmstat interval count

option - 让你指定所需的信息类型,例如 paging -p , cache -c ,.interrupt -i etc.

如果没有指定选项,将会显示进程、内存、页、磁盘、中断和cpu信息

interval - 同iostat

count - 同iostat

示例:

# vmstat 2
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr s0 s1 s2 s3   in   sy   cs us sy id
 8 0 0 13690040 3530888 38 150 0 0 0  0  0  0  0 -0  0 4224 6123 4809  1  1 97
 0 1 0 14582056 994832 8 80  2  2  2  0  0  0  0  0  0 5902 9678 6161  4  4 92
 0 1 0 14579120 992464 43 304 0 0  0  0  0  1  0  0  0 4967 8498 4858  4  3 93
 0 1 0 14579816 994808 221 1325 0 0 0 0  0 23  0  0  0 3807 11072 3660 4  3 93
 0 2 0 14579792 997448 0  0  0  0  0  0  0  0  0  0  0 3827 8948 3581  4  1 94
 0 1 0 14578328 997576 56 302 0 0  0  0  0  0  0  0  0 5607 9484 5916  4  2 93
 0 1 0 14578024 998808 0  0  0  0  0  0  0  0  0  0  0 6020 7387 5992  4  2 93
 0 2 0 14577936 1000328 0 0  0  0  0  0  0  0  0  0  0 4459 7933 4346  4  2 94
 0 1 0 14577680 1000856 0 3  0  0  0  0  0  0  0  0  0 4591 8336 4577  4  2 94
 0 0 0 14577560 1001760 0 19 0  0  0  0  0  0  0  0  0 5445 6626 5838  4  3 93

# vmstat disk
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr -- -- -- --   in   sy   cs us sy id
 8 0 0 13690104 3530696 38 150 0 0 0  0  0  0  0  0  0 4224 6123 4809  1  1 97

procs
r in run queue
b blocked for resources I/O, paging etc.
w swapped

memory (in Kbytes)
swap - amount of swap space currently available
free - size of the free list

page ( in units per second).
re page reclaims - see -S option for how this field is modified.
mf minor faults - see -S option for how this field is modified.
pi kilobytes paged in
po kilobytes paged out
fr kilobytes freed
de anticipated short-term memory shortfall (Kbytes)
sr pages scanned by clock algorithm

disk ( operations per second )
There are slots for up to four disks, labeled with a single letter and number.
The letter indicates the type of disk (s = SCSI, i = IPI, etc) . The number is
the logical unit number.

faults
in (non clock) device interrupts
sy system calls
cs CPU context switches

cpu - breakdown of percentage usage of CPU time. On multiprocessors this is an a
verage across all processors.
us user time
sy system time
id idle time

问题情况:
1.) 如果processes in run queue (procs r)的数量远大于系统中cpu的数量,将会使系统便慢。
2.) 如果这个数量是cpu的4倍的话,说明系统正面临cpu能力短缺,这将使系统运行速度大幅度降低
3.) 如果cpu的idle时间经常为0的话,或者系统占用时间(cpu sy)是用户占用时间(cpu us)两辈的话,系统面临缺少cpu资源

解决方案 :
解决这些情况,涉及到调整应用程序,使其能更有效的使用cpu,同时增加cpu的能力或数量。

内存问题:
内存的瓶颈取决于scan rate (sr) 。scan rate是每秒时钟对页的扫描 (he scan rate is the pages scanned by the clock algorithm per second.)如果 scan rate (sr)一直大于200 pages每秒,这时就是内存短缺的现实。
解决方案 :
1. 调整应用和服务器,使其能更好的使用memory和cache
2. 增加系统内存

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/196700/viewspace-754185/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/196700/viewspace-754185/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值