分享
 
 
 

Linux操作系统跑Linux慢的分析

王朝system·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

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 -xtc 5 2

extended disk statistics tty cpu

disk r/s w/s Kr/s Kw/s wait actv svc_t %w %b tin tout us sy wt id

sd0 2.6 3.0 20.7 22.7 0.1 0.2 59.2 6 19 0 84 3 85 11 0

sd1 4.2 1.0 33.5 8.0 0.0 0.2 47.2 2 23

sd2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0

sd3 10.2 1.6 51.4 12.8 0.1 0.3 31.2 3 31

The fields have the following meanings:

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)

Results and Solutions:

从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.) 将文件系统移到更快的磁盘/控制器,或者用更好的设备来代替

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

例子

The following command displays a summary of what the system

is doing every five seconds.

example% vmstat 5

procs memory page disk faults cpu

r b w swap free re mf pi p fr de sr s0 s1 s2 s3 in sy cs us sy id

0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82

0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62

0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64

0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78

The fields of vmstat's display are

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

结果和解决方案:

A. CPU issues:

下面几列需要被察看,以确定cpu是否有问题

Processes in the run queue (procs r)

User time (cpu us)

System time (cpu sy)

Idle time (cpu id)

procs cpu

r b w us sy id

0 0 0 4 14 82

0 0 1 3 35 62

0 0 1 3 33 64

0 0 1 1 21 78

问题情况:

1.) 如果processes in run queue (procs r)的数量远大于系统中cpu的数量,将会使系统便慢。

2.) 如果这个数量是cpu的4倍的话,说明系统正面临cpu能力短缺,这将使系统运行速度大幅度降低

3.) 如果cpu的idle时间经常为0的话,或者系统占用时间(cpu sy)是用户占用时间(cpu us)两辈的话,系统面临缺少cpu资源

解决方案 :

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

B. Memory Issues:

内存的瓶颈取决于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. 增加系统内存

dmidecode类似AIX的lsdev,所有的设备基本都可以看到。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有