AIX高级系统管理培训手册-142页文档资料

发布于:2021-07-30 19:05:29

IBM Systems & Technology Group
AIX 高级系统管理
? 2006 IBM Corporation

IBM Systems & Technology Group
第四章 磁盘管理
? 2006 IBM Corporation

IBM Systems & Technology Group
? 学会描述LVM的信息 ? 解决ODM库的问题 ? 如何建立镜像 ? 可以解释quorum机制 ? 能够描述物理硬盘的状态
3

? 2003 IBM Corporation

IBM Systems & Technology Group
LVM概念

4

? 2003 IBM Corporation

IBM Systems & Technology Group
Mirror 概念

5

? 2003 IBM Corporation

IBM Systems & Technology Group
Stripe的概念

6

? 2003 IBM Corporation

IBM Systems & Technology Group
Raid级别的介绍
? 常用的raid级别 ? 0,1,5,10的区别 ? 不同的raid的不同的优势 ? 了解系统级raid0和raid1的概念 ? 介绍硬件级别的raid产品(fastT,ssa)

7

? 2003 IBM Corporation

IBM Systems & Technology Group
基本的逻辑卷管理
? 了解什么是LVM管理 ? 如何创建卷组 ? 如何识别pv ? 如何使用pv ? 如何创建lv ? 如何创建文件系统 ? Lv和fs的关系 ? 如何管理lv和fs
8

? 2003 IBM Corporation

IBM Systems & Technology Group
概念
? Vgda(卷组描述区) ? Vgsa(由镜像产生) ? LVCB(逻辑卷控制块) ? AIX文件
9

? 2003 IBM Corporation

IBM Systems & Technology Group
VGDA

10

? 2003 IBM Corporation

IBM Systems & Technology Group
如何查看VGDA

11

? 2003 IBM Corporation

IBM Systems & Technology Group
如何查看LVCB

12

? 2003 IBM Corporation

IBM Systems & Technology Group
ODMandVGDA

13

? 2003 IBM Corporation

IBM Systems & Technology Group
PV在ODM中的信息

14

? 2003 IBM Corporation

IBM Systems & Technology Group


15

? 2003 IBM Corporation

IBM Systems & Technology Group


16

? 2003 IBM Corporation

IBM Systems & Technology Group
与VG相关的ODM库

17

? 2003 IBM Corporation

IBM Systems & Technology Group


18

? 2003 IBM Corporation

IBM Systems & Technology Group
与LV相关的ODM

19

? 2003 IBM Corporation

IBM Systems & Technology Group
ODM相关的LV的错误

20

? 2003 IBM Corporation

IBM Systems & Technology Group
解决问题

21

? 2003 IBM Corporation

IBM Systems & Technology Group
Rootvg的ODM错误

22

? 2003 IBM Corporation

IBM Systems & Technology Group
下面介绍mirror

23

? 2003 IBM Corporation

IBM Systems & Technology Group
系统级的镜像
? Rootvg镜像 ? 镜像的方法 ? 镜像以后的工作 ? 如何完成一个完整的rootvg镜像

24

? 2003 IBM Corporation

IBM Systems & Technology Group
非rootvg的镜像
? 概念 ? Mklvcopy ? 镜像的方法 ? 如何查询镜像的结果
25

? 2003 IBM Corporation

IBM Systems & Technology Group
镜像中的问题

26

? 2003 IBM Corporation

IBM Systems & Technology Group
如何创建mirrorLV

27

? 2003 IBM Corporation

IBM Systems & Technology Group
VGDA的数量

28

? 2003 IBM Corporation

IBM Systems & Technology Group
Quorum的概念

29

? 2003 IBM Corporation

IBM Systems & Technology Group
如何理解一个没有quorum的卷组
? Quorum的用途 ? Mirror不需要quorum(默认)

30

? 2003 IBM Corporation

IBM Systems & Technology Group
如何varyonvg不正常的VG

31

? 2003 IBM Corporation

IBM Systems & Technology Group
Mirror的联系
? 练*做rootvg的mirror ? 练*做lv的copy ? 联系作mklvcopy
32

? 2003 IBM Corporation

IBM Systems & Technology Group
第四章磁盘管理
? 在任何情况下替换磁盘 ? Vg fail的解决 ? 如何纠正不一致的错误 ? 导入导出卷组
33

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘替代的过程

34

? 2003 IBM Corporation

IBM Systems & Technology Group
情况一(disk mirror)

35

? 2003 IBM Corporation

IBM Systems & Technology Group
在线应用的磁盘

36

? 2003 IBM Corporation

IBM Systems & Technology Group
特别对于rootvg

37

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘彻底损坏

38

? 2003 IBM Corporation

IBM Systems & Technology Group


39

? 2003 IBM Corporation

IBM Systems & Technology Group
非rootvg磁盘的彻底损坏

40

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘删除问题

41

? 2003 IBM Corporation

IBM Systems & Technology Group
解决方案

42

? 2003 IBM Corporation

IBM Systems & Technology Group
Exportvg和importvg

43

? 2003 IBM Corporation

IBM Systems & Technology Group
importvg

44

? 2003 IBM Corporation

IBM Systems & Technology Group
Importvg问题

45

? 2003 IBM Corporation

IBM Systems & Technology Group
文件系统冲突

46

? 2003 IBM Corporation

IBM Systems & Technology Group
如何同时mount两个同名fs

47

? 2003 IBM Corporation

IBM Systems & Technology Group

? Importvg之前没有使用exportvg ? 解决方法

48

? 2003 IBM Corporation

IBM Systems & Technology Group

49

? 2003 IBM Corporation

IBM Systems & Technology Group

50

? 2003 IBM Corporation

IBM Systems & Technology Group
第五章 备份恢复
? 2006 IBM Corporation

IBM Systems & Technology Group
VG的保存和恢复
? 创建,鉴别,恢复mksysb ? 利用mksysb创建clone ? 如何减小文件系统和逻辑卷 ? 替换磁盘安装 ? 备份,恢复非rootvg ? 如何进行jfs的在线备份
52

? 2003 IBM Corporation

IBM Systems & Technology Group
mksysb

53

? 2003 IBM Corporation

IBM Systems & Technology Group
磁带中的内容

54

? 2003 IBM Corporation

IBM Systems & Technology Group
验证系统备份
? 验证系统备份的方法

55

? 2003 IBM Corporation

IBM Systems & Technology Group
Mksysb的控制文件

56

? 2003 IBM Corporation

IBM Systems & Technology Group
磁带安装的恢复

57

? 2003 IBM Corporation

IBM Systems & Technology Group


58

? 2003 IBM Corporation

IBM Systems & Technology Group
用mksysb克隆系统

59

? 2003 IBM Corporation

IBM Systems & Technology Group
恢复时修改pp

60

? 2003 IBM Corporation

IBM Systems & Technology Group
恢复系统并减小文件系统

61

? 2003 IBM Corporation

IBM Systems & Technology Group
硬盘克隆

62

? 2003 IBM Corporation

IBM Systems & Technology Group
第一种方法

63

? 2003 IBM Corporation

IBM Systems & Technology Group
通过smit完成

64

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘的克隆

65

? 2003 IBM Corporation

IBM Systems & Technology Group
通过smit进行

66

? 2003 IBM Corporation

IBM Systems & Technology Group
删除

67

? 2003 IBM Corporation

IBM Systems & Technology Group
如何备份非rootvg

68

? 2003 IBM Corporation

IBM Systems & Technology Group
Vgname.data

69

? 2003 IBM Corporation

IBM Systems & Technology Group
Savevg的恢复

70

? 2003 IBM Corporation

IBM Systems & Technology Group
在线的fs备份

71

? 2003 IBM Corporation

IBM Systems & Technology Group
分开这个mirror

72

? 2003 IBM Corporation

IBM Systems & Technology Group
重新整合这个fs

73

? 2003 IBM Corporation

IBM Systems & Technology Group
linux和unix下常用解压和压缩命令:
? --------------------------------------------? .tar ? 解包: tar xvf FileName.tar ? 打包:tar cvf FileName.tar DirName(注:tar是打包,不是压
缩!)

? --------------------------------------------? .gz ? 解压1:gunzip FileName.gz ? 解压2:gzip -d FileName.gz ? 压缩:gzip FileName.tar.gz ? 解压:tar zxvf FileName.tar.gz ? 压缩:tar zcvf FileName.tar.gz DirName
74

? 2003 IBM Corporation

IBM Systems & Technology Group
linux和unix下常用解压和压缩命令:
? .Z ? 解压:uncompress FileName.Z ? 压缩:compress FileName.tar.Z ? 解压:tar Zxvf FileName.tar.Z ? 压缩:tar Zcvf FileName.tar.Z DirName ? --------------------------------------------? .tgz ? 解压:tar zxvf FileName.tgz ? 解压:tar zxvf FileName.tar.tgz ? 压缩:tar zcvf FileName.tar.tgz FileName ? --------------------------------------------? .zip ? 解压:unzip FileName.zip ? 压缩:zip FileName.zip DirName
75

? 2003 IBM Corporation

IBM Systems & Technology Group
第六章 系统DUMP
? 2006 IBM Corporation

IBM Systems & Technology Group
本章目的
? 了解在系统dump时保存的数据 ? 确认和改变主dump设备和第二dump设备 ? 创建系统的dump

77

? 2003 IBM Corporation

IBM Systems & Technology Group
系统DUMP概述
? 当发生一个意外的系统中断或系统故障就会创建一个系
统DUMP
? DUMP是指把系统物理内存中部分或全部内容复制到指
定的设备,即把内核所使用的内存区域的数据保存。
? 系统崩溃或手工执行,对操作系统状态的快照 ? 0c0:DUMP成功

78

? 2003 IBM Corporation

IBM Systems & Technology Group
? smitty dump ? sysdumpdev –l ? sysdumpdev –e ? sysdumpdev –P –p|-s lvname ? sydumpdev –L显示统计信息 ? snap
79

? 2003 IBM Corporation

IBM Systems & Technology Group
产生dump的途径

Copies kernel data structure to a dump device

Via keyboard initiation

At unexpected system halt

Via smit

Via reset button

Via comand

Classial RS/6000 only
80

? 2003 IBM Corporation

IBM Systems & Technology Group
Dump 里的内容
? 不包含PAGED MEMORY的内容 ? 包含系统的变量和状态 ? 进程表
– 当前运行的进程和其相关信息
? 用户区
– 当前用户运行的进程和其相关的详细信息 – 文件描述表(FDT)
? 虚拟文件系统的信息
– 当前mounted的文件系统 – Inode table – open file table
81

? 2003 IBM Corporation

IBM Systems & Technology Group

Dump 里的内容(续)
? 内核堆栈 ? 系统Buffer ? 终端信息 ? Mbufs
– These are the memory buffers for data which have been sent/received across a network
? Sockets ? Timers

82

? 2003 IBM Corporation

IBM Systems & Technology Group
命令sysdumpdev

? 列出当前的dump设备及状态

– # sysdumpdev -l

primary

/dev/hd6

secondary

/dev/sysdumpnull

copy directory /var/adm/ras

forced copy flag TRUE

always allow dump FALSE

83

? 2003 IBM Corporation

IBM Systems & Technology Group
命令sysdumpdev (续)
? 设置dump设备
– # sysdumpdev [-P]{-p|-s} device – 参数P代表永久的改变,参数p代表主dump设备
? 查看当前系统的dump大小
– # sysdumpdev -e
0453-041 Estimated dump size in bytes: 31631360
? 显示出以前dump的信息 – # sysdumpdev -L

84

? 2003 IBM Corporation

IBM Systems & Technology Group
Methods of Starting a Dump

Any Terminal Accepting Input
NO
lft Keyboard Attached
NO
85

YES

Sysdumpstart {-p|-s} or
smit

YES

With key in service or Force mode,press
<CTRL>-<ALT>- <??? ü??1> <CTRL>-<ALT>- <??? ü??2>

With key in SERVICE mode press the Reset button once
? 2003 IBM Corporation

IBM Systems & Technology Group
通过smit产生dump
# smit dump
System Dump Move cursor to desired item and press Enter.
Show Current Dump Devices Show Information About the Previous System Dump Show Estimated Dump Size Change the Primary Dump Device Change the Secondary Dump Device Change the Directory to which Dump is Copied on Boot Start a Dump to the Primary Dump Device Start a Dump to the Secondary Dump Device Copy a System Dump from a Dump Device to a File Copy a System Dump from a Dump Device to Diskette Always ALLOW System Dump

F1=Help Esc+9=Shell
86

F2=Refresh Esc+0=Exit

F3=Cancel Enter=Do

Esc+8=Image
? 2003 IBM Corporation

IBM Systems & Technology Group

拷贝系统的Dump
dump occurs

dump occurs NO

YES
Dump copied to /var/adm/ras

Is there sufficient space in /var to copy dump to
NO
Display the copy dump to tape menu

Boot in Service (if normal boot not
possible)

Is there sufficient space in /var to copy dump to

YES

Dump copied to

NO

/var/adm/ras

Display the copy dump to tape menu

login prompt

diagnostic menus

87

? 2003 IBM Corporation

IBM Systems & Technology Group
发送dump到IBM系统支持中心
? 拷贝dump到磁带上
– # /usr/sbin/snap -gfkD -o /dev/rmtx
? dump磁带的标记
– PMR(Problem Management Record)号 – 创建磁带的命令 – 块大小
? IBM通过crash命令处理dump磁带
88

? 2003 IBM Corporation

IBM Systems & Technology Group
第七章 错误分析和诊断
? 2006 IBM Corporation

IBM Systems & Technology Group
本章目的
? 了解AIX错误报告工具的组成部分 ? 解释错误报告 ? 监测和维护错误日志

90

? 2003 IBM Corporation

IBM Systems & Technology Group
错误日志和系统日志
? 能够分析错误日志 ? 能够鉴别和维护产生的错误 ? 用syslogd纪录系统消息

91

? 2003 IBM Corporation

IBM Systems & Technology Group
错误日志的目的
? 在监测到硬件、软件和操作错误时记录相应的信息 ? 用户其他的相关信息被记录下来 ? 报告通过记录产生 ? 用户能够客户化错误信息 ? 当发生某些特定的错误时,系统发出指定信息 ? 可以查询到建议操作

92

? 2003 IBM Corporation

IBM Systems & Technology Group
Errorlog过程

93

? 2003 IBM Corporation

IBM Systems & Technology Group
syslogd
配置文件:/etc/syslog.conf 选择器:功能名,功能名.优先级; 处理方法:接受信息目标位置(文件、用户、主
机) 循环:

94

? 2003 IBM Corporation

IBM Systems & Technology Group
通过smit使用error log功能
Error Log Move cursor to desired item and press Enter.
Generate Error Report Change / Show Characteristics of the Error Log Clean the Error Log

F1=Help Esc+9=Shell

F2=Refresh Esc+0=Exit

F3=Cancel Enter=Do

95

? 2003 IBM Corporation

IBM Systems & Technology Group

通过smit产生错误报告

Generate an Error Report

Type or select values in entry fields. Press Enter AFTER making all desired changes.

[TOP]

CONCURRENT error reporting?

SUMMARY or DETAILED error report

Error CLASSES (default is all)

Error TYPES (default is all)

Error LABELS (default is all)

Error ID's

(default is all)

Resource CLASSES (default is all)

Resource TYPES (default is all)

Resource NAMES (default is all)

SEQUENCE numbers (default is all)

STARTING time interval

ENDING time interval

LOGFILE

[MORE...3]

[Entry Fields]

no

summary

+

[]

+

[]

+

[]

+

[]

+X

[]

[]

[]

[]

[]

[]

[/var/adm/ras/errlog]

F1=Help Esc+5=Reset Esc+9=Shell

F2=Refresh Esc+6=Command Esc+0=Exit

F3=Cancel Esc+7=Edit Enter=Do

F4=List Esc+8=Image

96

? 2003 IBM Corporation

IBM Systems & Technology Group
通过smit产生错误报告
? 显示所有的错误报告
– # errpt
? 打印错误报告的模板
– # errpt -t
? 按时间产生报告
– # errpt -a -s mmddhhmmyy
? 只报告硬件错误
– # errpt -d -H
? 描述ID为F49E2A17的错误报告
– # errpt -a -j F49E2A17
97

? 2003 IBM Corporation

IBM Systems & Technology Group
报告实例

# errpt

IDENTIFIER TIMESTAMP T C RESOURCE_NAME 192AC071 0106141400 T O errdemon 1581762B 0106115000 T H cd0 1581762B 0106100100 T H cd0 1581762B 0105152300 T H cd0 2CCF66F7 0105111300 T H bl0 2BFA76F6 0105111100 T S SYSPROC 9DBCFDEE 0105111300 T O errdemon 192AC071 0104174500 T O errdemon 2CCF66F7 0104143300 T H bl0 2BFA76F6 0104143100 T S SYSPROC 9DBCFDEE 0104143300 T O errdemon 192AC071 0104143000 T O errdemon C60BB505 0104105800 P S SYSPROC

DESCRIPTION ERROR LOGGIN DISK OPERATI DISK OPERATI DISK OPERATI DEVICE ERROR SYSTEM SHUTD ERROR LOGGIN ERROR LOGGIN DEVICE ERROR SYSTEM SHUTD ERROR LOGGIN ERROR LOGGIN SOFTWARE PRO

98

? 2003 IBM Corporation

IBM Systems & Technology Group
参数详解
? 标识‘C’:错误归类
– H:硬件 – S:软件 – O:系统信息已经记录 – U:不能确定
? 标识‘T’:错误类型
– PERM(并且C为H):显示系统遇到硬件问题并且无法自动修复 – PERD(并且C为H):系统硬件变为不可用并引起一系列错误系统 – PERM(并且C为S):显示系统遇到软件问题并且无法自动修复 – TEMP(并且C为S):显示系统遇到软件问题并且已经自动修复

99

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘错误类型
? DISK_ERR1(cd,disk or R/W optical operation failure)
– PERM – failure of physical volume media
? DISK_ERR2(cd,disk or R/W optical operation failure)
– PERM – failure in disk assembly(for example , poer loss)
? DISK_ERR3 (cd,disk or R/W optical operation failure)
– PERM – failure was detected by the SCSI adapter

100

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘错误类型(续)
? DISK_ERR4(cd,disk or R/W optical recovered error)
– TEMP – error caused by a bad block or event of a recovered error
? DISK_ERR5(Undetermined Error)
– PERM – SCSI device driver failure of unknown type

101

? 2003 IBM Corporation

IBM Systems & Technology Group
磁盘错误的处理
? 诊断程序
– 帮助确定问题的严重性 – 可以格式化磁盘或进行磁盘片的检查
? 磁盘片的检查
– 检查在磁盘上的每一个块 – 报告磁盘全面状况总结报告
? 三种应该更换磁盘的情况
– 噪声很大(Noise) – 经常出错 – 错误严重
102

? 2003 IBM Corporation

IBM Systems & Technology Group
错误日志的清除(自动)
? 在root用户的cron表中,缺省有两个entry
– 0 11 * * * /usr/bin/errclear -d S,O 30
? 每天清除一次,清除三十天以前的软件错误
– 0 12 * * * /usr/bin/errclear -d H 90
? 每天清除一次,清除九十天以前的硬件错误

103

? 2003 IBM Corporation

IBM Systems & Technology Group
错误日志的清除(手工)
? root用户通过手工命令errclear直接清除错误日志
– # errclear 10
? 清除10天以前的所有日志
– # errclear -d H 0
? 清除所有硬件的错误
– # errclear -N disk 0
? 删除所有资源组为disk的记录
– # errclear -T UNKN 0
? 删除所有类型为unknown的记录
– # errclear 0
? 删除所有记录

104

? 2003 IBM Corporation

IBM Systems & Technology Group
在出错日志中加入信息
? # errlogger “(字符)”

105

? 2003 IBM Corporation

IBM Systems & Technology Group
通过errdemon命令管理错误日志 (壹)

? 显示error log的特性

– # /usr/lib/errdemon -l

Error Log Attributes

--------------------------------------------

Log File

/var/adm/ras/errlog

Log Size

1048576 bytes

Memory Buffer Size 8192 bytes

106

? 2003 IBM Corporation

IBM Systems & Technology Group
通过errdemon命令管理错误日志(贰 )
? 改变错误日志的存放文件
– # /usr/lib/errdemon -i filename
? 改变文件的大小
– # /usr/lib/errdemon -s logsize
? 改变内存缓冲区的大小
– # /usr/lib/errdemon -B buffersize

107

? 2003 IBM Corporation

IBM Systems & Technology Group
出错处理命令软件包
? bos.rte 包含errinstall, errupdate,errstop命令
? bos_sysmgt.serv_aid包含errmsg,errclear, errdead,
errlogger, errmsg, errpt, sysdumpstart 命令

108

? 2003 IBM Corporation

IBM Systems & Technology Group
第八章 性能监测和优化
? 2006 IBM Corporation

IBM Systems & Technology Group
本章目的
? 通过AIX标准命令研究系统中CPU,内存和I/O瓶颈 ? 了解AIX相关的AIX命令 ? 使用PDT产生系统状况的报告 ? 使用perfpmr工具 ? 调整内核参数

110

? 2003 IBM Corporation

IBM Systems & Technology Group
硬件资源和逻辑资源
硬件资源
CPU 内存
磁盘空间
通信

逻辑资源
时间片 页面桢 堆栈 缓存区 队列 表 逻辑卷 文件系统 文件 数据包 通道

111

? 2003 IBM Corporation

IBM Systems & Technology Group
Performance Tools
? # nice ? # renice ? # ps ? # sar ? # vmstat ? # iostat ? # tprof ? # svmon ? # filemon ? PDT(Performance Diagnostic Tool) ? perfpmr(Performance Problem Management Report)
112

? 2003 IBM Corporation

IBM Systems & Technology Group

vmstat

sar

Y

nice

ps

vmstat

ps

Y

lsps

svmon

CPU瓶颈?
N
N 内存瓶颈?

nfso

no

Y

ifconfig

netpmon

I/O瓶颈? N
netstat nfsstat
网络瓶颈?

iostat

Y

lslv

filemon

fileplace

N More test

113

? 2003 IBM Corporation

IBM Systems & Technology Group
进程的生命周期图示

SNONE SIDL

R

T

S

runing

Zombie

114

? 2003 IBM Corporation

IBM Systems & Technology Group
进程的生命周期说明(一)
? 初始化(I)阶段
– Before a process is created, itneeds a slot in the process table; at this stage it is in the SNONE state
– While a process is undergoing creation, waiting for resources to be allocated,it is in the SIDL state

115

? 2003 IBM Corporation

IBM Systems & Technology Group
进程的生命周期说明(二)
? 运行(A)阶段
– R: Ready to run – S: 等待I/O操作 – T: stop 与restart 中的暂停阶段 – Runing: 运行阶段
? 退出死亡(A)阶段
– When a process dies(exit) it becomes a zombie

116

? 2003 IBM Corporation

IBM Systems & Technology Group

进程的优先级
? 优先级由run-queue slot 确定 ? 最高的优先级为0,最低为127 ? 优先级分为两种:
– 固定的:
? 确定的内核进程 ? 通过setpri()设置为实时应用 ? 没有nice值
– 不固定的:
? Run at initial priority level which subsequently changes ? CPU-intensive(running)processes not favored ? I/O-intensive(sleeping) processes favored

117

? 2003 IBM Corporation

IBM Systems & Technology Group
优先级的查看

# p s - l n r o o t

FSU I D P I D P P I D CP R IN IA D D R S Z W C H A N T T Y T I M EC M D

2 4 0 0 0 1A 01 1 5 1 81 4 1 0 0 0 6 02 03 6 7 1 3 4 8

p t s / 1 0 : 0 0 k s h

2 0 0 0 0 1A 01 4 4 8 01 1 5 1 8 0 6 42 4 a 2 5 8 0 5 4 c e 6 1 8 p t s / 1 0 : 0 0s l e e p

2 0 0 0 0 1A 01 4 9 6 41 1 5 1 8 5 6 22 0 d 4 4 2 7 6

p t s / 1 0 : 0 0 p s

? 参数C:recent CPU usage value ? 参数PRI:priority value——优先级 ? 参数NI:nice value

118

? 2003 IBM Corporation

IBM Systems & Technology Group
优先级的计算
? priority value =base value + nice value + (CPU
penalty based on recent CPU usage)
– base value(the user-process-priority value):40 – 在ksh下,默认的nice值:前台是20,后台是24 – CPU penalty = (recent CPU use value) * (r value / 32)
? r 默认值为16

119

? 2003 IBM Corporation

IBM Systems & Technology Group
nice行命令格式
? # nice -i <number> command ? 参数i(或者n): 从默认的NI值中增加或减少相应的值。 ? 参数<number>范围为-24到+19,缺省为10

120

? 2003 IBM Corporation

IBM Systems & Technology Group
命令nice 示例
# nice -10 sleep 100000 & # nice -n -15 sleep 100000 & # nice -n -10 sleep 100000 & # nice -n -10 sleep 100000
用ps -le | grep sleep命令输出如下:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 200001 A 0 18112 2492 0 74 34 35fa 44 9ef72d8 pts/3 0:00 s 200001 A 0 9666 2492 0 49 9 2bf5 44 9ef7658 pts/3 0:00 s 200001 A 0 16068 2492 0 54 14 21f0 44 9ef7698 pts/3 0:00 s 200001 A 0 10182 2492 0 50 10 fe7 44 9ef76d8 pts/3 0:00 s

121

? 2003 IBM Corporation

IBM Systems & Technology Group
renice行命令格式
? 用来改变一个正在运行的进程NI值 ? #renice <number> { [-p] <PID>}{-u <username> }

122

? 2003 IBM Corporation

IBM Systems & Technology Group
命令ps
? #ps -ef
– E选项:列出所有的用户进程 – l选项:列出优先级信息
? # ps aux
– 查看所有进程占用CPU,内存,时间
? # ps -mo ThREAD
– TID 参数:象PID一样是Thread-id – BND 参数:使用CPU数
123

? 2003 IBM Corporation

IBM Systems & Technology Group
性能分析流程
?ì ?é CPU

check run queue length

CPU??????????

High queue length
possible CPU
constraint
124

?é ?? ?? ??

High paging

?ì ?é ?? ??

possible memory
constraint

disk balanced

Balance disk

possible disk/SCSI constraint

? 2003 IBM Corporation

IBM Systems & Technology Group
性能分析流程

sar -u

sar -q

CPU??????????

High queue length
possible CPU
constraint
125

vmstat

High paging

iostat

possible memory

disk balanced

constraint Balance disk

possible

disk/SCSI

constraint

? 2003 IBM Corporation

IBM Systems & Technology Group
CPU 使用情况(一)

# sar 1 10
AIX 43p-140 3 4 001000B74C00

03/09/00

10:47:50 10:47:51 10:47:52 10:47:53 10:47:54 10:47:55 10:47:56 10:47:57 10:47:58 10:47:59 10:48:00

%usr 0 0 0 0 0 0 0 1 1 1

%sys 0 0 0 0 0 0 0 0 0 1

%wio 1 0 0 0 0 0 0 0 0 0

%idle 99 100 100 100 100 100 100 99 99 98

Average

0

0

0 100

◆ 当 %usr+%sys > 80% 时,CPU 紧张

126

? 2003 IBM Corporation

IBM Systems & Technology Group
CPU 使用情况(二)

# sar -q 1 3

系统队列活动情况

AIX43p-14034001000B74C00 03/09/00

11:20:00 runq-sz %runocc swpq-sz %swpocc

11:20:01 1.2

100

11:20:02 1.0

100

11:20:03 1.1

100

Average 1.2

100

?runq-sz: average length of run queue ?%runocc:percentage of time run queue occupied ?swpq-sz %swpocc:

◆当runq-sz大于4时,CPU资源紧张
127

? 2003 IBM Corporation

IBM Systems & Technology Group
sar –a 3 5 查看文件读/写情况 iget/s:每秒调用I节点查找函数的次数 lookuppn/s:每秒调用目录查找函数的次数 dirblk/s:为一个文件调用目录查找函数的次数

128

? 2003 IBM Corporation

IBM Systems & Technology Group

sar –d

块设备活动情况

%busy > 50%或 avwait > avscrv则需要查看磁 盘I/O

sar –c

系统调用情况

129

? 2003 IBM Corporation

IBM Systems & Technology Group
sar –r 查看页面调度情况 slots:页面空间上空闲页数量 cycle/s:每秒页面交换周期数 fault/s:每秒页面错误个数 odio/s:每秒非磁盘I/O页面调用数
130

? 2003 IBM Corporation

IBM Systems & Technology Group

Paging 信息(一)
# vmstat 1 3

kthr memory

page

faults cpu

----- ----------- ------------------------ ------------ -----------

r b avm fre re pi po fr sr cy in sy csussyidwa

0 0 808713425 0 0 0 0 0 0110 115 30 0 098 1

0 0 808713425 0 0 0 0 0 0115 212 34 0 099 0

0 1 808713425 0 0 0 0 0 0153 118 68 0 45442

◆当内存资源十分紧张时,将引起paging-stealing 和 paging-space activity,进而产生I/O 问题

131

? 2003 IBM Corporation

IBM Systems & Technology Group
Paging 信息(二)
? Kthr
– r:CPU运行的队列 – b:等待I/O的队列
? memory:
– avm:number of active virtual 4k pages – fre: size of the free list - the number of free 4k frames of
RAM

132

? 2003 IBM Corporation

IBM Systems & Technology Group

Paging 信息(三)

? page

– re: pi/po:page-ins/page-outsusing the paging-space

– fr/sr:pages freed/scanned by the page-straler, the program that free RAM

– cy:clock cycles used by page-replacement algorithm - very unlikely to be non-zero, as that would indicate frantic memory cleansing behaviour!

? faults

– in: 设备中断次数

– sy:系统调用的次数

– cs:kernel thread context switches

133

? 2003 IBM Corporation

IBM Systems & Technology Group
I/O 信息

# iostat

tty:

tin 0.0

tout avg-cpu: %user %sys %idle %iowait

2.5

0.1 0.4 98.9 0.6

Disks: hdisk0 cd0

% tm_act 0.7 0.0

Kbps 4.2 0.0

tps Kb_read Kb_wrtn

0.7 66560 14626

0.0

0

0

?%tm_act is the percent of time the device was active over the period
?Kbps is the number of kilobytes per second transferred.
?tps is number of transfers per second

134

? 2003 IBM Corporation

IBM Systems & Technology Group
确定CPU瓶颈
? 在确定了CPU瓶颈之后,进一步确定程序使用CPU的
情况
? 在AIX中用tprof命令产生报告

135

? 2003 IBM Corporation

IBM Systems & Technology Group
内存情况
? Pinned memory:不能被page-stealer的内存 ? AIX内存中的三种类型:
– Persistent: This is used to hold pages read form filesystems
– Client: For NFS data, and CD-ROM pages strangely – Working : Here we hold the data and variables of a
program

136

? 2003 IBM Corporation

IBM Systems & Technology Group

查看内存整体的使用情况(一)

# svmon -G

m e m o r y

i n u s e

p i n p g s p a c e

s i z e i n u s e f r e e p i n w o r k p e r s c l n t w o r k p e r s c l n t s i z e i n u s e

3 2 7 6 8 2 2 4 4 4 1 0 3 2 4 1 9 5 9 1 4 2 5 2 8 1 9 2 0 1 9 5 9 0 0 6 5 5 3 6 9 2 6 3

137

? 2003 IBM Corporation

IBM Systems & Technology Group
查看内存整体的使用情况(一)
? Memory
– size:真正的内存大小 – inuse:使用的内存 – free:没使用的内存 – pin:pinned memory的 大小

138

? 2003 IBM Corporation

IBM Systems & Technology Group
调整性能参数
? smitty chgsys
? Aio(smitty etherchannel命令 调aio经验值范 围10~40,一般是数据库I/O接口速度)
? chps ? vmo(vmtune)

139

? 2003 IBM Corporation

IBM Systems & Technology Group
调整性能参数(2)
? lsattr –El ent0
– tx_que_size – rx_que_size
? 调整网络的工具:
– no – chdev – ifconfig
140

? 2003 IBM Corporation

IBM Systems & Technology Group
调整性能参数(3)
? no –a ? no –o thewall ? 设置mbuf为3MB:
– no –o thewall=3072 – no –o tcp_spendspace=16384 – no –o tcp_recvspace=16384 – 修改非永久,若需要则加入到/etc/rc文件

141

? 2003 IBM Corporation

谢谢!
142


相关推荐

最新更新

猜你喜欢