免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5115 | 回复: 5
打印 上一主题 下一主题

[系统管理] AIX资源监控与调制工具[转贴] [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-02 22:18 |只看该作者 |倒序浏览
AIX资源监控与调制工具
本文出自:http://www.ccw.com.cn 作者: 陆成新 (2002-04-15 06:02:01)
性能优化以及确定系统中的性能瓶颈是系统管理员的主要任务之一。在一个计算机系统中,CPU、内存、硬盘和网络是影响系统性能的主要因素,因此系统性能调整也主要在于如何在这些资源中获得某种平衡,以满足人们对系统性能的期望。性能调制需要很多技巧,知识以及经验,不能仅靠分析统计数字,图表就可取得,性能调制有时是一件复杂甚至是非常困难的任务。
如同其它UNIX系统一样,AIX也给系统管理员剪裁系统提供了非常丰富的手段。这里我们简单介绍RS/6000 AIX系统中几个用于监控和调制多项系统资源的工具,每个工具的功能都很强,如想更透彻地了解这些命令的用法,请参考有关技术资料或手册。这里讲述的命令将不仅仅局限于CPU、硬盘、内存或网络资源的某个方面,它们可用于其中的一项或多项资源。
AIX监控工具
1、iostat
iostat命令主要通过观察物理磁盘的活跃时间以及他们的平均传输速度,监控系统输入/输出设备负载。根据iostat命令产生的报告,用户可确定一个系统配置是否平衡,并据此在物理磁盘与适配器之间更好地平衡输入/输出负载。
iostat工具的主要目的是通过监控磁盘的利用率(tm_act字段),而探测到系统中的I/O瓶颈。iostat还可用于确定CPU问题,辅助容量规划,并可以为最终解决I/O问题提供相关材料。vmstat和iostat联合使用,可捕获到确定与CPU,内存和I/O子系统有关的性能问题的必需数据。
iostat命令可产生下面四种类型的报告:
· tty和CPU利用情况
· 磁盘的利用情况
· 系统吞吐率
· 适配器吞吐率
2、netpmon
netpmon命令可以监控关于网络行为的系统事件和性能以及网络行为对CPU的消耗。netpmon命令在指定的监控周期报告网络行为。
netpmon启动后直至发布trcstop命令终止它之前,一直在后台运行。如果使用缺省设置,trace命令将会在netpmon命令之后立即自动启动。另外,netpmon中还可用trcon命令选择在后面的某个时间跟踪。当这种跟踪用trcstop命令终止后,netpmon命令就会输出它的报告并退出。缺省时报告会输出到标准输出,需要时也可以重定向到某个文件。
netpmon命令还可以在一次先前产生的跟踪中以脱机模式使用。在这样的情况下,需要用gennames命令产生一个文件。该文件必须在trace终止后立即产生。
所产生的报告中包括CPU使用情况、网络设备驱动器I/O情况、互联网络套接字调用,以及网络文件系统(NFS)I/O信息:
· CPU use:netpmon命令报告线程和中断处理器对CPU的使用情况。该命令将网络相关行为的CPU使用情况与其它行为的CPU使用情况区分开。
· Network Device Driver I/O:netpmon命令监控网络适配器上所通过的I/O统计。
· Internet Socket Calls:netpmon命令在互联网络套接字上监控read,recv,recvfrom,write,send以及sendto子程序。ICMP,TCP,UDP这几个协议的每个进程都会予以报告。
· NFS I/O:netpmon命令监控客户NFS文件上的read和write子程序,NFS客户上的RPC请求以及NFS服务器的read和write请求。
3、PDT(性能诊断工具)
PDT通过收集和集中各种性能、配置和可用数据自动找出性能问题。PDT评估系统的当前状态并跟踪系统在工作量和性能上的变化。PDT数据收集和报告很容易起用,不需要更多的管理行为。
虽然许多常见的系统性能问题都有特定性,但PDT还试图用一些被认为性能好的系统中的通用概念来帮助它查找问题。这些概念包括:
· 资源的平衡使用
· 在限定范围操作
· 确定的工作量趋势
· 无错误操作
· 系统参数得到适当设置。
4、ps
ps命令是UNIX系统中最常见的命令,它主要显示系统中关于进程的统计和状态信息,如进程ID,I/O行为以及CPU利用率等。利用ps命令提供的信息,可决定一个进程运行了多长时间,进程使用了多少CPU时间,以及进程是否受系统的惩罚。还可用ps命令确定进程使用了多少内存,完成多少I/O,进程的优先级以及是谁创建了进程。
下面这几个命令组合对于管理RS/6000 AIX系统有帮助:
(1)显示10个消耗CPU最多的进程:
# ps aux |head -1 ;ps aux |sort -rn +2 |head –10
(2)显示10个消耗存储空间最多的进程:
# ps aux |head -1 ;ps aux |sort -rn +3 |head -10
(3)按顺序显示系统中受罚的进程:
#ps -eakl |head -1 ;ps -eakl |sort -rn +5
(4)按优先级顺序显示系统中的进程:
#ps -eakl |sort -n +6 |head
(5)按处理时间为顺序显示系统中的前十个进程:
#ps vx |head -1 ;ps vx |grep -v PID |sort -rn +3 |head –10
(6)按实际内存使用的多少顺序显示系统中的前十个进程:
#ps vx |head -1 ;ps vx |grep -v PID |sort -rn +6 |head –10
(7)按换入页面的多少顺序显示系统中的前10个进程:
#ps vx |head -1 ;ps vx |grep -v PID |sort -rn +4 |head -10
5、vmstat
vmstat命令报告关于核心线程,虚拟内存,自陷(trap),磁盘以及CPU行为的统计。而且每种行为报告都被更细致地用百分比分别表示用户态、核态、空闲以及等待磁盘I/O等情况。
内核维持了对核心线程,换页以及中断行为的统计数据,而vmstat命令则通过使用knlist子程序和/dev/kmen伪设备驱动器访问这些数据。磁盘的输入/输出统计是通过设备驱动器维持的。对于磁盘,平均传输速度是通过使用活跃时间核传输信息数目决定的。而活跃时间百分比则是从报告期间驱动器忙的时间量计算出来的。
vmstat命令产生五种类型的报告:
· 虚存行为报告
· fork子进程情况报告
· 每个设备产生的中断情况报告
· 汇总报告
· 输入/输出行为报告
6、sar
sar命令报告CPU的使用情况,I/O以及其它系统行为。sar命令可以收集,报告以及保存系统行为信息。如果没有指定输入文件,则sar调用sarc命令访问系统数据。
用户可用让cron命令运行两个shell脚本(/usr/lib/sa/sa1和/usr/lib/sa2)以提供日统计和报表。在crontab文件/var/spool/cron/crontabs/adm中包括了一些样本节,用于示范cron要在何时运行这些shell脚本。以这种方式收集到的数据对于确定系统的时间周期特征和决定峰值使用时间是有用的。
但要注意的是,sar命令自己运行时会产生相当数量的读写。因此最好在没有工作量的情况下运行sar统计,看看sar对总的统计数字有多大的影响。
7、topas
topas命令用于监控各种系统资源,如CPU的使用情况,CPU事件和队列,内存和换页空间的使用,磁盘性能,网络性能以及NFS统计等。它还会报告指派给不同WLM类的进程对系统资源的消耗情况。它还能报告系统中最热门的进程和工作量管理器(WLM)的热门类。有关WLM类信息只有在WLM激活时才会显示。topas命令将热门进程定义为那些使用大量CPU时间的进程。topas命令没有作日志的选项,所有信息都是实时的。
topas命令利用System Performance Measurement Interface(SPMI)API获得有关信息。正是因为通过SPMI API,使系统开销保持在最小程度。topas命令使用perfstat库调用访问perfstat内核扩展。
8、truss
truss命令跟踪一个进程的系统调用、所接收的信号以及招致的机器错。要检查的应用程序可在truss命令的命令行中指定,也可将truss命令挂在一个或多个已经在运行的进程上。
AIX调制工具
1、fdpr
fdpr命令改进用户级程序和库的执行时间和对实际内存的使用。fdr命令可以通过不同的操作,如删除不必要的指令和重组代码和数据,而实现这样的目标。fdr命令安装在目录/usr/bin下。
fdpr命令在三个不同阶段上,对原有的执行代码应用先进的优化技术从而为其构筑一个优化的可执行代码。这三个阶段分别是:
· 在阶段1,fdpr创建一个增加了某些装置(instrumented)的可执行程序。原有的可执行程序被保存为__ProgramFile.save,而新版本被命名为__ProgramFile.instr。
· 在阶段2,fdpr运行该增加了某些装置的可执行程序,并收集摘要(profiling)数据。该摘要数据被保存在一个叫__ProgramFile.prof的文件中。运行执行程序时需要为它提供典型的输入数据,以使fdpr命令能够找出代码中可优化的部分。
· 在阶段3,fdpr命令使用阶段2中收集到的重要信息对可执行代码重新排序。这些重新排序涉及到这样一些任务:
(1)将那些高频度执行代码序列包装在一起。
(2)对条件分之重新排序,以改进硬件对分之条件的预测。
(3)将较少使用的代码部分移出来。
(4)内嵌一些热门函数。
(5)从重排序后的代码中删除掉NOP(空操作)指令。
另外,编译器中还提供了一个-qfdpr标志,用它可使编译器在执行代码中增加一些额外的信息,以辅助fdpr对该执行代码重新排序。但是,如果使用这个-qfdpr标志,则fdpr也只对那些用-qfdpr标志编译的模块重新排序。
2、schedtune
schedtune命令可以给抖动、进程挂起、时间片以及线程在锁上所能轮询的时间长度等设置准则。
用schedtune,可调整AIX中所设立的一组影响其内存负载控制机制的参数。Schedtune命令用于显示和修改那些用于检测系统内存是否在过度使用以致造成抖动的参数。Schedtune命令还能用于修改运行在系统上的进程的惩罚和衰减因子。在root用户下,用schedtune命令可做下面的事情:
· 决定用于确定抖动的准则。
· 决定哪个准则用于挂起进程。
· 决定在抖动终止后要等待多长时间才重新激活那些先前被挂起的进程。
· 决定被挂起的进程的最小数目。
· 调制调度优先级公式。
· 更改时间片数值。
· 决定在一把锁上轮询多长时间。
· 将schedtune值复位到它的缺省值。
需要注意的是,所有用schedtune作的修改在系统重启后都将丢失。为了确保所需的schedtune值在引导时能够置上,可在/etc/inittab文件中插入适当的schedtune命令。如:schedt:2nce:/usr/samples/kernel/schedtune -s 65536
3、vmtune
vmtune命令负责显示和调整虚存管理器(VMM)和其它AIX部件使用的参数。系统中的根用户可动态修改包括下面这些参数:
· VMM页替换
· 永久文件读写
· 文件系统缓冲区结构(bufstructs)
· LVM缓冲区
· 裸输入/输出
· 换页空间参数
· 页删除
· 内存固定参数

(http://www.fanqiang.com)     进入【UNIX论坛】

论坛徽章:
0
2 [报告]
发表于 2003-03-03 11:01 |只看该作者

AIX资源监控与调制工具[转贴]

顶!!!

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
3 [报告]
发表于 2003-03-03 12:51 |只看该作者

AIX资源监控与调制工具[转贴]

好贴,给你一个精华!

论坛徽章:
0
4 [报告]
发表于 2003-03-03 17:26 |只看该作者

AIX资源监控与调制工具[转贴]

好好

论坛徽章:
0
5 [报告]
发表于 2003-03-28 14:14 |只看该作者

AIX资源监控与调制工具[转贴]

Here is a page I downloaded before, I forget where it come from. Share with you all. I think this is a very good document for you.

Performance Tuning WebWizard
Oracle RDBMS Tuning for AIX

Use this WebWizard to tuning your Oracle RDBMS running on an IBM pSeries with AIX. This WebWizard assumes you are a Database Administrator (DBA).
Note these are the AIX specific tuning tips. See also the UNIX general tuning tips.

We take no credit for this information as its taken from the Oracle Manuals.


Tip 1 - Use Asynchronous I/O
In the init.ora configuration file set: use_async_io=true
Then set the minservers and maxservers using SMIT->;Devices->;Asynchronous I/O->;Change/Show Characteristics of Asynchronous I/O (or just type smit aio) to:

MaxServers = 10 * number of disks
MinServers = MaxServers /2
This is likely to increase performance by 6 - 8%.
Tip 2 - Use Parallel Recovery
In the init.ora configuration file set: recovery_parallelism=[number of CPUs but not less than 2]
This is likely to increase recovery processing by 0 - 50%.

Tip 3 - Use Logical Volume Manager
To spread out the data across disks you could use Oracle files or the AIX LVM. It is strongly recommended that the LVM is used. Striping data across disks is very effective as it makes full use of the disks in usage terms, makes excellent use of read ahead for sequential I/O and spreads I/O evenly (better perforamnce). For striping use the following:
Stripe unit size 64KB
max_coalesce 64KB
minpgahead 2
maxpgahead 16
Note: the striped LV size must be a multiple number of the drives used.
Note: striped data and log must be on different sets of dicks.
Note: AIX LVM does not currently allow striping and mirroring at the same time.
This is likely to increase performance by 0 - 500%.

Tip 4 - Use readv()
In the init.ora configuration file set: use_readv=TRUE
This effectively ask the AIX Kernel not to buffer reads (particularly JFS files) and should increase performance.

Note this can make performance worse so test this firsts.

Tip 5 - Use db_file_multiblock_read_count
In the init.ora configuration file set: db_file_multiblock_read_count=[8 or 16]
This should be set to db_block_size*db_file_multiblock_read_count is greater than the LVM stripe size.

Tip 6 - Use JFS or Raw Partitions
This is a well worn subject with agruments on both sided.
JFS - If your database is not I/O bound i.e. you do lots of computation on data retrieved the JFS will be nice because its simpler to administer and backup/recover.
Raw partitions/raw disks/raw logical volume - otherwise use these for performance.
Moving to Raw Disks is likely to increase performance by 0 - 50%.

Tip 7 - Direct I/O
Not implemented on AIX.
Tip 8 - Use Write Behind
Disable the AIX feature by setting the AIX parameter using: vmtune -c 0
Note to set the AIX parameter back to normal: vmtune -c 8

This might not be suitable unless the machine is solely a database server.

Tip 9 - Tune Sequential Read Ahead
The Virtual Memory Manager spots sequential reading of files by watching the access pattern. After a number of reads in order are noticed, it will attempt to read upto maxphahead blocks of the file in adavance. By default these are:
minpgahead 2
maxpgahead 8
These can be increased to increase sequential reading of data using: vmtune -r 512 -R 1024
Keep the numbers powers of 2.

Tip 10 - Tune Disk I/O Pacing
Disk I/O pacing is an AIX feature that stops disk I/O intension applications flooding the CPU. This is done with low and high water marks via: smit->;System Environment->;Change/Show Characteristics of OS.
Be careful as this can hurt performance if not set correctly.

Tip 11 - Using RAID
Raid can improve read performance but is slow in write. For performance never use RAID as random I/O is typically 4 times slower.
Tip 12 - Disk Geometry Considerations
On AIX you can place data of particular parts of the disk. The middle part of the disk being the fastest as it reduces seek times.
This may increase performance by 10%

Tip 13 - Use Processor Binding on SMP
Certain processes can be locked to run on a particular CPU. This increases level 1 cache hits but the process cannot then float to unused CPU's if its CPU is busy. Use the bindprocessor command.
Note: do not use bind processor on AIX 3

You can use this feature to bind the main Oracle processes to different CPUs with good effect. Also, if the SQL*Net listener is bound its forked off servers for use connection are also bound.

This may increase performance by 15%

Tip 14 - Spin Count on SMP
This can reduce Oracle internal latch contention. In the init.ora configuration file the default is: spin_count=2000
Increasing this means the process will spin longer waiting for the process on other CPUs to free the latch so it can continue. Setting this to 0 can help on single CPU machines or when CPU usage is very high.

Tip 15 - Process Priority
Warning: getting this wrong may crash your machine.
Only the root user can set this using the setpri() system call.

Increasing the priority (reducing the number) can improve performance if there are lots of runnable processes on the machine. Oracle provide a setorapri command to do this: setorapri 39

This may increase perforamnce by 15%

Tip 16 - Buffer Cache Paging
For JFS database there can be a copy of the SGA block in the Buffer Cahce too. This can effect performance and cause I/O bottlenecks. There are four AIX buffer cache tuning parameters:
minfree - below this page stealing starts trying to reclaim memory pages
maxfree - above this page stealing stops
minperm - minimum number of pages allocated to File I/O
maxperm - maximum number of pages allocated to File I/O
Increase minfree and maxfree so that read ahead pages do not reduce free pages to zero and there is alway free memory.
Tip 17 - File Buffer cache
You can adjust the minperm and maxperm (see tip 16) to effect the size of the buffer cache resources.
This depend so much on the workload and I/O characterists of your database that its difficult to recommend particular values. Try: vmtune -p 30 -P 60

The defaults are 20 and 80.

Tip 18 - Paging Space
Never run out of paging space. Two to three time RAM is typical. Use: lsps -a to determine the size and use of paging.
Tip 19 - Block Size
db_blcok_size=4096 for small, JFS and OLTP/mixed workload databases
db_block_size=8192 for raw lare DSS workload
Tip 20 - Redo Buffer Latch
Set the following init.ora file parameters:
log_small_entry_max_size= 0
log_simultaneous_copies=[2 times the number of CPUs]
Tip 21 - Archiver Buffers
The log_archive_buffer_size effects the perforamcne of the archiver which is used to copy log files to other resources so they can be reused later. Set the init.ora file parameter:
log_archive_buffer_size=[upto 128]
log_archive_buffer=[default of 4]
Over doing this can degrade performance but may give 20% better performance.

Tip 22 - SGA Size
The SGA must not be paged or swapped out. The amount of memory that can be allocated to the SGA depends on:
high numbers of users need more SGA
actual RAM available
if the machine is a DB server or stand alone
Set the init.ora parameters:
db_block_buffers
shared_pool_size
For example as a rough guide:

System type  Stand alone  Server only  
OLTP  30% of RAM  40% to 60% of RAM  
DSS  40% to 70% of RAM  50% to 80% of RAM  


Tip 23 - SQL*Loader I/O Buffers
While loading data with SQL*Loader it ends up waiting for the I/O to complete. Increasing the BUFFERS parameter will improve load performance.
Tip 24 - Out-of-bound breacks with SQL*Net TCPIP
This is the communications use between client and server and by default is switched on (orasrv does this).
This may increase perfromance by 20%

Tip 25 - Post-Wait Kernel Extension
This reduces the overhead of semaphore operations.
Make sure the correct version is installed.
This may increase performance by 20%

Tip 26 - TCPIP
SQL*Net V2 uses 2KB packet sizes. The underlying packet size is 1KB for most installations.
This can be changed with SQL*Net connection string parameters.
It is not recommended to change this as it can degrade perforamnce.

Tip 27 - Compliling Pro*C
Use the right optimisation level
-O3
Compile for the right chipset:

-qarch=COM for the common mode (i.e. runs on everything)
-qarch=PWR for POWER only machines
-qarch=PWRX for POWER2 only machines
-qarch=PPC for POWERPC only machines

论坛徽章:
0
6 [报告]
发表于 2003-03-29 09:31 |只看该作者

AIX资源监控与调制工具[转贴]

楼上的!!
where do u get it from...it's very!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP