AIX 5L 性能优化,第 1 部分 监视 CPU
AIX 5L 内存性能优化之使用 ps、sar、svmon 和 vmstat 监视内存的使用

AIX 5L 内存性能优化之使用ps、sar、svmon 和vmstat 监视内存的使用AIX 5L 内存性能优化之使用ps、sar、svmon 和vmstat 监视内存的使用,通过命令监控AIX系统的内存使用状况,进而进行系统内存的性能优化,是一个系统管理员对系统优化要做的基本工作!内存子系统中最重要的优化部分并不涉及到实际的优化工作。
在对您的系统进行优化之前,必须弄清楚主机系统的实际运行情况。
要做到这一点,AIX® 管理员必须知道应该使用何种工具,以及如何对他或她将要捕获的数据进行分析。
再次说明近期发表的一些其他优化文章中所介绍的内容,您在对系统进行正确地优化之前,必须首先监视主机,无论它是在逻辑分区(LPAR) 运行还是在自己的物理服务器上运行。
您可以使用许多命令来捕获和分析数据,所以您需要了解这些命令,以及其中的哪个命令最适合于将要进行的工作。
在捕获了相关的数据之后,您需要对结果进行分析。
有些问题乍看起来像是一个中央处理单元(CPU) 的问题,而经过分析之后,可以正确地诊断为内存或I/O 问题,前提是您使用了合适的工具捕获数据,并且知道如何进行分析工作。
仅当正确地完成了这些工作之后,您才可以考虑对系统进行实际的更改。
如果医生不了解您的病史和目前的症状,就无法诊治疾病,同样地,您也需要在优化子系统之前对其进行诊断。
如果在出现CPU 或者I/O 瓶颈的情况下,对内存子系统进行优化,这将是毫无帮助的,甚至可能会影响主机的正常运行。
本文将帮助您了解正确地实施诊断工作的重要性。
您将看到,性能优化并不仅仅只是进行实际的优化工作。
在您将要学习的工具中,有一些是通用的监视工具,所有版本的UNIX 都提供了这些工具,另外还有一些工具是专门为AIX 编写的。
有些工具为AIX Version 5.3 进行了优化,同时还专门为AIX 5.3 系统开发了一些新的工具。
生成基准数据是非常重要的,这一点无论重申多少次都不为过。
AIX 5L 内存性能优化

AIX 5L 内存性能优化内容提要:AIX 5L 内存性能优化说明:什么是交换(分页)空间?它是与VMM 有关的。
VMM 使用交换(分页)空间存储没有使用活动RAM 的进程。
正是因为这个目的,交换空间是系统整体性能的关键组件。
作为一名管理员,您需要了解如何监视和优化您的分页参数。
分页空间本身是一个特殊的逻辑卷,它存储了当前不访问的信息。
您必须确保您的系统拥有足够的分页空间。
如果分页空间过小,整个进程可能会丢失,并且当所有的空间都占满后,系统可能会崩溃。
尽管值得再次说明,分页空间是VMM 中的一部分,但是更重要的是真正地理解内核如何将进程调入到RAM 中,过多的分页肯定会对性能造成影响。
AIX 通过将内核与VMM 紧密集成在一起,实现了一种称为请求分页的方法。
事实上,内核本身的大部分都驻留在虚拟内存中,这样可以帮助释放它的片段空间以用于其他进程。
>> 请求分页大多数管理员都认为分页是一件很麻烦的事情。
实际上,分页是AIX 所完成的任务中非常必要的一部分,这是由于AIX 内核与VMM 及其请求分页的实现进行了紧密的集成。
请求分页的工作原理是,内核一次仅加载部分页面到实际内存中。
当CPU 需要另一个页面时,它会到RAM 中查找。
如果无法在RAM 中找到这个页面,则出现一次缺页,然后向内核发出信号以便从磁盘中加载更多的页面到RAM。
请求分页的一个优点是,分页空间不需要非常大,因为数据总是在分页空间和RAM 之间不断地交换。
在较早的UNIX? 系统中,将分页预先分配到磁盘,无论使用还是不使用它们。
这使得所分配的磁盘空间可能永远不会被使用。
从本质上说,请求分页可以避免盲目地分配磁盘空间。
应该使得进程的交换最少,因为许多任务可能存储在RAM 中。
的确如此,因为进程(页面)只有一部分存储在RAM 中。
交换指的是什么呢?尽管分页和交换通常可以互换使用,但它们之间存在细微的区别。
如前所述,在进行分页时,进程的部分内容将在磁盘和RAM 之间来回移动。
IBMAIX操作系统基础知识培训

LCD都要显示一些数字信息
它为您指示:
正在进行加载的设备 当前的工作状态 加载失败的原因
可以在诊断手册中查到数字信息的含义
ZHE JIANG COLLABORATION DATA SYSTEM LTD.
系统初始化-第一阶段
•由服务处理器运行
• 进行自检,代码显示在前面板上 • 识别适配器和部件 • 按照配置列表查找引导设备 • 从引导设备上加载AIX,否则在LCD上显示错误代码 • rootvg 和 /dev/hd5 • 使用: lsvg -l rootvg 检查(type = boot)
AIX主要组件-shell
AIX 的缺省 shell 为:
Korn ksh AIX 有其他的shell可以供选用
查找已执行过的命令:
$ set -o vi 启动 vi 命令行 按 <esc> 前一行:<esc>+ k 其它的 vi 命令如: h l x i a 搜索: <esc> /字符串
ZHE JIANG COLLABORATION DATA SYSTEM LTD.
第一单元 AIX介绍
ZHE JIANG COLLABORATION DATA SYSTEM LTD.
AIX介绍
• AIX全名为(Advanced Interactive Executive),它是IBM公司的
UNIX操作系统,整个系统的设计从网络、主机硬件系统,到操作系
统完全遵守开放系统的原则。
系统初始化-第二阶段
服务器上设备的配置
启动AIX,运行 cfgmgr 识别各类硬件设备 加载动态设备驱动程序
可从LCD上观察到正在配置的哪个设备 设备越多,花费的时间越长
AIX系统性能分析与监控

1 O0・
A X 系统性 能分析 与j I {
孟繁园
( 荣科科技股份有限公 司, 江 哈 尔滨 102 ) 黑龙 500
摘 要 : A X 系统性 能 出现 问题的 时候 , 该对服务器进行合理 管理和监控 , 在 I 应 通过一 堪 使 用率、 盘 I 磁 / O以及 网络 这四个性 能指标的现状。通过榆 出结果判断 出系统性能所存 在的粥
关键 词 : 酶 X 程 ; 要 意 义 ; 生 物 发 - 重 微
酶是有催化作用 的蛋 白质。酶 工程主要利用酶( 括细胞和细 如果把中东地区每天 自燃 的天然气 中的一半用来生产单细胞 蛋 白, 包 胞器) 能催化生物化 学反应 的特征 , 并借 助现代催化理 论与技术 手 就可以维持 1 0亿人 口对粮食的需求。 段, 以反应器 的形式进行产品生产的技术体 系。 微生 物合成脂肪更具有诱人 的前景 。利用微生物发酵法生产脂 现代 发酶工程 的 目的 , 是利用发酵产物 ( 也称代谢产物 ) 以及微 肪 , 早在 13 9 0年就已开始 , 不过那时转化率不高。 大豆 、 花生 的脂肪 生物本身 。 含量为 1— 5 芝麻则 为 5 %, 高脂 肪植物 。而微生物 , 2 2 %, 3 是 如某些 什 么叫微生物代谢产物 ?可举一个 比较典 型的例子 : 过去生产 酵母 的含量脂 高达 5 — 0 比芝 麻的含量还 高 , 令人高兴 的是 , 0 6 %, 更 味精 是用 麸皮 和面筋作原料 的 , 生产 1吨味精需要 3 0吨小麦 , 经济 微生物脂肪 中不含油酸和 亚油酸 , 预防心血 管病 、 对 治疗 动脉血管 效益不 高。后来发现微生物 的代谢 中有谷 氨酸生成( 味精 )因此改 硬 化 有利 。 , 用微生物发酵 生产谷氨酸 , 3吨淀 粉 即可生产 1吨味精 , 用 而且 鲜 2 世纪 , 生物脂肪生产将成为发酵工业的另一支柱产业 。 1 微 度更 高。 微生物代谢 产物很 多 , 乙醇 、 从 维生素 、 氨基 酸到抗生 素 、 醋 2 微 生 物 可 合 成 化 工 原 料 酸、 乳酸等 , 至甘油 、 甚 油漆也可 以生成 。加拿大科学家 发现一种微 根据科学 家预测 ,l 2 世纪 中生产化工原料 的一些 方法会被发酵 生物能合 成石 油 , 因此用微生物发酵生产石油将成 为现 实。 法所代替。这是因为利用微 生物合成的化工原料越来越受 到青睐 。 何谓微生 物菌体 的利用 ? 微生物菌体本身就是 由蛋 白质 、 脂肪 、 据不完全统计 , 微生 物 已经可 以合成 的化: 原料 多达数 百种 , E 它们 淀粉 、 维生素 以及其他活性物质所构成 。人类 利用微生 物的历史很 包括溶剂 、 润滑剂 、 软化剂 、 萃化 剂 、 胶粘剂 、 酸化剂 、 塑料 、 炸药 、 汽 久, 古埃及人做面包和我们祖先酿酒 , 便是直接利用微生物 的例子 。 油添加剂 、 代用燃 料 、 化妆品 、 阻冻剂 、 刹车油 、 柠檬 酸 、 乙醇 、 乙烯 、 微生物学 家深入研究后 , 发现微生物能在菌体 内积 累大量的脂肪和 乙醛 、 丙醇及丁二烯等 。 蛋 白质 , 因此把微 生物看成新 的营养源加 以利用 , 不仅 是理想 的饲 种有工业前途 的有机 化合 物 , 常是 用化学合成 或者生物 合 通 料, 也是人造 肉、 物的添加剂 。 药 成的方法得到的。 究竟采川哪一种方法 , 取决于经济效益 。 生物合成 1单细胞蛋 白和脂肪生产 是用微生物发酵 , 其原料是糖类和淀粉 。而化学 合成其原料是石 油 世界 人 口不断增加 , 粮食短缺成 了世 界性 的大问题。寻找新的 和它的衍生物。 一般来说 , 微生物合成 比较爱欢迎 。 现在 已经有 2 0 0 粮食来源, 前最主要的方法是提高农作物产量。 目 然而, 单细胞蛋白 多种具有商业 价值的化 工原料正在用发酵法生产 。 脂族类有机物没有 苯环 或类 似结 构 ,根据 它们 的不 同用途 , 可 也是 增加 人类 蛋白需求 的重要途径 。 经过选育 的微生物( 如酵母 、 细 菌 )其蛋 白含量高达 4-0 比大豆 和花生 的含量还要高得多。 , 0 8%, 特 分为溶剂和有机酸。溶剂包括乙醇 、 丁醇 、 正 丙酮 和甘 油 ; 有机 酸包 柠檬酸和乳酸等 。这些有机酸都 可以用发酵法进行工 业化 别 使人高兴 的是 , 细胞蛋 白中含 有人体所必需 的氨基 酸 , 单 它的营 括醋酸 、 养价值胜过猪 肉、 和鸡蛋 。 鱼 生 产 。例 如 , 发 酵 法 生 产 乙 醇 ( 精 )开 创 了利 用 植 物 纤 维 素 、 用 酒 , 木 木 2 微 生物 以氢为原料合成 蛋 白质 , 容易被人所 吸收消化 , 能有效 质 素 的先 河 。地 球 上 绿 色 植 物 每 年 生 产 的 纤 维 素 、 质 素 高 达 10 很 并 地维 持人体生理功能 ,每天吃 7 — 0 0 10克单细胞蛋 白就足 以满足人 亿吨 , 如果 其中 5 %转化为乙醇 , 0 就是 6 亿 吨。 乙醇不仅 是化 工原 0 料, 也是燃 料 , 它可代替汽油发动汽车 。纤维素 和木质 素取之不竭 , 体需要。 利用细胞进行单细胞生产 , 它的原料 是大气 中的氢和用之不竭 用之不完 , 每年 可以由绿色植物生产 。因此 , 乙醇是 可再 生原 料。 的水 , 加上氧 、 二氧 化碳 、 少量铵盐 、 硝酸盐 和含氮化合 物就 可 以进 微生物学 家近年来还发现了嗜热性细菌 , 它们 可 以在 比较 高的 07  ̄ 而 行发酵 。 这些原料在 自然界十分丰富 , 价格低廉 。 发酵是在一个密封 温度条件下 进行 发酵 。这种菌在 6 — 0C条件 下最宜生 长繁殖 , 的发酵罐 中进行的 , 酵过程 自动控制 , 发 可连续生产 。 一个 30升 的 且代谢旺盛 , 0 转化率相 当高 , 比其他菌种 的转化率 高出许多倍 , 它对 可不 再因在发酵过程 中释放 出来 的热量而 发酵罐 , 一个小 时可获得 O . 5千克 菌液 , 昼夜可生产 1 一 2千克单 细 发酵工业来说十分重要 , 胞蛋 白, 这是任何 高产 的动物和植物都无法 比拟 的。 据科学家估计 , 冷却发酵罐 , 之能连续发酵 , 使 从而大大提高了生产效率。
AIX查看命令

AIX查看命令1.查看cpu:1.1 #pmcycles (从aix 5.1开始在bos.pmapi.pmsvcs包中)1.2 #lsattr -El proc*2.查看内存:2.1 #lsattr -El mem*2.2 #lsattr -El sys0 -a realmem2.3 #bootinfo -r2.4 #getconf REAL_MEMORY (5L,hpux也有该命令,不过用法有差别。
另外,在aix中还可以用getconf HARDWARE_BITMODE和KERNEL_BITMODE来分别查看机器的硬件和操作系统是32位还是64位)3.查看model,sn:#uname -Mu 结果如下IBM,7043-150 IBM,01105DE2CE其中IBM,7043-150是model,01105DE2CE中的105DE2CE就是机器上标明的sn:10-5DE2CE,也就是序列号4.查看系统的maitenance level:4.1 #oslevel -r4.2 #instfix -i |grep ML5.查看哪些文件集没有打到相应的maitenance level:#instfix -icqk 5100-02_AIX_ML |grep ":-:" 或#oslevel -rl 5100-026.查看当前运行的fileset的maintenance level:#lslpp -lnotes:PTF用installp安装,APAR用instfix安装7.installp命令7.1 安装在 软件包中的所有的filesets到/usr/sys/inst.images:#installp avX d /usr/sys/inst.images 7.2 清除一个中断的安装和删除所有没有完成的安装#installp C7.3 提交安装(commit):#installp cgx 或smitty install_commit7.4 删除所有未committed的在./reject.list中的updates,同时将系统带回到以前的maintenance level:#installp rBfx ./reject.list 或smitty install_reject7.5 删除一个安装的软件:#installp ugp V2 .ipsec.rte 或smitty install_remove7.6 列示介质上的所有软件:#installp L d /dev/cd0在超级用户下键入smitty mksysb然后出现对话窗口键入备份装置( 如/dev/rmt0 ),按回车。
优化AIX 7磁盘性能 第一部分磁盘I O概述和长期监控工具【sar+nmon+ topas】

优化AIX 7磁盘性能第一部分磁盘I/O概述和长期监控工具【sar+nmon+ topas】简介磁盘 I/O 优化的关键部分涉及到在构建系统之前实现最佳实践。
因为当系统已经启动并处于运行状态时,很难再对数据进行移动,所以需要在规划磁盘和 I/O 子系统环境时正确地完成这项任务,这一点是非常重要的。
这包括物理架构、逻辑磁盘排列以及逻辑卷和文件系统配置。
当系统管理员听到可能出现了磁盘争用问题时,他或她首先会求助于 iostat。
iostat 等同于使用 vmstat 提供有关内存的报告,它是获得有关 I/O 子系统的当前运行概况的一种快速而原始的方法。
尽管运行 iostat 并不是一种完全不合理的反应,但是很早就应该着手考虑磁盘 I/O 的问题,而不是等到必须进行调优的时候。
如果没有从一开始就正确地为环境配置磁盘,那么任何调优工作都无法提供帮助。
而且,有一点非常重要,需要了解磁盘 I/O 的具体情况,以及它与 AIX® 和 your System p™ 硬件之间的关系。
对于磁盘 I/O 调优来说,AIX 特有的工具和实用工具比通用的 UNIX® 命令和工具能够提供更多的帮助,因为它们的任务就是帮助优化本机 AIX 磁盘 I/O 子系统。
在本文中,我们要定义和介绍 AIX I/O 栈,并将其与磁盘性能的物理和逻辑方面关联起来。
本文介绍直接、并发和异步 I/O:它们是什么,如何启用它们,以及如何监控和优化它们。
本文还介绍一些长期监控工具,应该使用它们来帮助优化系统。
听到 iostat 并不是我们推荐的帮助长期收集统计数据的工具,您可能会感到奇怪。
本文讨论 AIX 7 的 beta 版中的支持和变化,包括不同子系统的配置方式方面的变化。
AIX 7 中的主要变化进一步简化了许多 I/O 子系统的操作和配置,这个改进过程从 AIX 6 就开始了。
其结果是许多 I/O 子系统不再需要启用和配置了。
AIX5L系统管理培训教程
04
AIX5L系统进程管理
进程概念及类型
进程定义
进程是操作系统中进行资源分配 和调度的基本单位,是程序的执
行过程。
进程类型
根据进程的性质和作用,可分为系 统进程、用户进程和守护进程等。
进程状态
进程在执行过程中,会呈现不同的 状态,如运行、就绪、阻塞等。
查看进程状态
ps命令
用于显示当前系统中进程 的状态信息,如进程ID、 父进程ID、进程状态等。
根据数据价值和存储空间,设定合理的备份保留期限 。
常用备份工具介绍
AIX5L系统自带备份工具
如`tar`、`cpio`等,可实现基本的数据备份 功能。
第三方备份软件
如Veritas NetBackup、IBM Tivoli Storage Manager等,提供更强大的备份和恢复功能。
网络备份设备
常见选项
-r(递归删除目录及其内容)、-f(强制删除,不提示确认)
用户和组管理
useradd:添加用户 用法:`useradd [选项] 用户名`
常见选项:`-d`(指定用户主目录)、`-g`(指定用户所属组)
用户和组管理
userdel:删除用户 用法:`userdel [选项] 用户名` 常见选项:`-r`(同时删除用户主目录和邮件池)
学习如何创建文件系统,包括选择合适的文件系统类型、设置文件系统
参数等。
03
文件系统挂载与卸载
掌握如何挂载和卸载文件系统,以及如何在系统启动时自动挂载文件系
统。
磁盘配额管理
磁盘配额概念
了解磁盘配额的概念和作用,以及它在AIX5L系统中的实 现方式。
磁盘配额设置
学习如何设置磁盘配额,包括对用户和组设置磁盘使用限 制、设置配额宽限期等。
AIX操作系统性能分析报告
AIX操作系统性能分析报告1)CPU$ vmstat 5 5System configuration: lcpu=8 mem=7744MBkthr memory page faults cpu----- ----------- ------------------------ ------------ ----------- r b avm fre re pi po fr sr cy in sy cs us sy id wa1 5 1943309 1817 0 341 109 2018 6836 0 1246 3524 5000 34 3 32 311 8 1943312 861 0 23 812 1975 2909 0 1227 776 4348 13 3 45 392 6 1945483 1855 0 78 737 1189 1880 0 639 1287 2119 30 1 39 302 5 1949024 1921 0 307 73 1002 2973 0 511 3190 1719 57 1 20 224 9 1959284 2146 0 400 35 2745 21198 0 824 21885 30 45 62 2 12 24从上面结果看出,CPU的idle在12-45之间,wait在22-39之间,表示目前处于空闲状态的CPU基本属于正常;但是处于等待状态的CPU较多,即有较多的进程在等待获取资源后才能进入CPU运行。
2)内存$ vmstat 5 5System configuration: lcpu=8 mem=7744MBkthr memory page faults cpu----- ----------- ------------------------ ------------ ----------- r b avm fre re pi po fr sr cy in sy cs us sy id wa1 5 1943309 1817 0 341 109 2018 6836 0 1246 3524 5000 34 3 32 311 8 1943312 861 0 23 812 1975 2909 0 1227 776 4348 13 3 45 392 6 1945483 1855 0 78 737 1189 1880 0 639 1287 2119 30 1 39 302 5 1949024 1921 0 307 73 1002 2973 0 511 3190 1719 57 1 20 224 9 1959284 2146 0 400 35 2745 21198 0 824 21885 30 45 62 2 12 24从上面看出,avm(激活虚拟内存页)为1.95M*4K=7.8G;fre(物理内存中的空闲页)为1.9k*4k=7.6M,而物理内存有8G,表示物理内存已经被充分利用。
AIX性能调优-牛新庄-
AIX性能调优系统资源(物理资源,逻辑资源)系统瓶颈性能概念一个程序执行步骤性能调整流程Instructor GuideFigure 1-6. Program Execution Hierarchy AU187.0 Notes:IntroductionIn the graphic above, the left side represents hardware entities that are loosely matched to the appropriate operating system entity on the right side. A program must go from the lowest level of being stored on disk, to the highest level being the processor running program instructions.Hardware hierarchy overviewWhen a program runs, it makes its way up the hardware and operating systemhierarchies, more or less in parallel. Each level on the hardware side is scarcer and more expensive than the one below it. There is contention for resources amongprograms and time spent in transitional from one level to the next. Usually, the time required to move from one hardware level to another consists primarily of the latency of the lower level, that is, the time from the issuing of a request to the receipt of the first data.1-18 AIX 5L System Administration III© Copyright IBM Corp. 2000, 2006Course materials may not be reproduced in whole or in partInstructor Guide Disks are the slowest hardware operationBy far the slowest operation that a running program does (other than waiting on a human keystroke) is to obtain code or data from a disk. Disk operations are necessary for read or write requests for programs. System tuning activities frequently turn out to be hunts for unnecessary disk I/O or searching for disk bottlenecks since disk operations are the slowest operations. For example, can the system be tuned to reduce paging? Is one disk too busy causing higher seek times because it has multiple filesystems which have a lot of activity?Real memoryRandom Access Memory (RAM) access is fast compared to disk, but much moreexpensive per byte. Operating systems try to keep program code and data that are in use in RAM. When the operating system begins to run out of free RAM, it needs to make decisions about what types of pages to write out to disk. Virtual memory is the ability of a system to use disk space as an extension of RAM to allow for more efficient use of RAM.Paging and page faultsIf the operating system needs to bring a page into RAM that has been written to disk or has not been brought in yet, a page fault occurs, and the execution of the program is suspended until the page has been read in from disk. Paging is a normal part of the operation of a multi-processing system. Paging becomes a performance issue when free RAM is short and pages which are in memory are paged-out and then paged back in again causing process threads to wait for slower disk operations. How virtual memory works will be covered in another unit of this course.Translation Lookaside Buffers (TLBs)One of the ways that programmers are insulated from the physical limitations of the system is the implementation of virtual memory. The programmer designs and codes the program as though the memory were very large, and the system takes responsibility for translating the program's virtual addresses for instructions and data into realaddresses that are needed to get the instructions and data from RAM. Since thisaddress-translation process is time-consuming, the system keeps the real addresses of recently accessed virtual memory pages in a cache called the Translation Lookaside Buffer (TLB).As long as the running program continues to access a small set of program and data pages, the full virtual-to-real page-address translation does not need to be redone for each RAM access. When the program tries to access a virtual-memory page that does not have a TLB entry, called a TLB miss, dozens of processor cycles, called theTLB-miss latency are required to perform the address translation.© Copyright IBM Corp. 2000, 2006Unit 1. Performance Analysis and Tuning Overview1-19Course materials may not be reproduced in whole or in partInstructor GuideCachesTo minimize the number of times the program has to experience the RAM latency, systems incorporate caches for instructions and data. If the required instruction or data is already in the cache (a cache hit), it is available to the processor on the next cycle (that is, no delay occurs); otherwise, a cache miss occurs. If a given access is both a TLB miss and a cache miss, both delays occur consecutively.Depending on the hardware architecture, there are two or three levels of cache, usually called L1, L2, and L3. If a particular storage reference results in an L1 miss, then L2 is checked. If L2 generates a miss, then the reference goes to the next level, either L3, if it is present, or RAM.Pipeline and registersA pipelined, superscalar architecture allows for the simultaneous processing of multipleinstructions, under certain circumstances. Large sets of general-purpose registers and floating-point registers make it possible to keep considerable amounts of the program's data in registers, rather than continually storing and reloading the data.Operating system hierarchy overviewThe operating system works on a thread level. When a user requests the execution of a program, AIX performs a number of operations to transform the executable program on disk to a running program. First, the directories in the user's current PATH must be scanned to find the correct copy of the program. Then the system loader (not to be confused with ld, the binder) must resolve any external references from the program to shared libraries. Finally, the system branches to the entry point of the program and the resulting page fault causes the program page that contains the entry point to be brought into RAM.Interrupt handlersThe mechanism for notifying the operating system that an external event has taken place is to interrupt the currently running thread and transfer control to an interrupt handler (FLIH or SLIH). Before the interrupt handler can run, enough of thegeneral-purpose registers must be saved to ensure that the system can restore the context of the running thread after interrupt handling is complete.ThreadsA thread is the current execution state of a single instance of a program. In AIX, accessto the processor and other resources is allocated on a thread basis, rather than a process basis. Multiple threads can be created within a process by the application program. Those threads share the resources owned by the process within which they are running.1-20 AIX 5L System Administration III© Copyright IBM Corp. 2000, 2006Course materials may not be reproduced in whole or in partWaiting threadsWhenever an executing thread makes a request that cannot be satisfied immediately, such as an I/O operation (either explicit or as the result of a page fault) or the granting ofa lock, it is put in a Wait state until that request is complete. Normally, this results inanother set of TLB and cache latencies, in addition to the time required for the request itself. However, it also allows other threads which are ready to run to gain access to the CPU.When a thread is replaced by another thread on a CPU, this is a context switch. A context switch can also occur when a thread finishes its timeslice or, as stated above, it must wait for a resource. Whenever a context switch occurs, there may be additional latencies due to cache misses. Context switches are a normal function of amulti-processing system, but an abnormally high rate of context switches could be a symptom of a performance problem.Dispatchable threadsWhen a thread is dispatchable, but not actually running, it is put in a run queue to run on an available CPU. If a CPU is available, it will run right away, otherwise it must wait. Currently dispatched threadThe scheduler chooses the thread that has the strongest claim to use the processor.When the thread is dispatched, the logical state of the processor is restored to what was in effect when the thread was last interrupted.Effect of the use of cache, RAM, and paging space on program performanceAccess time for the various components increase exponentially as you move away from the processor. For example, a one second access time for a 1 GHz CPU would be the equivalent of 100 seconds for a L3 cache access, 6 minutes for a RAM access, and 115 days for a local disk access! As you can see, the closer you are to the core, the faster the access is. Understanding how to reduce more expensive (performance-wise)bottlenecks is key to performance management.© Copyright IBM Corp. 2000, 2006Unit 1. Performance Analysis and Tuning Overview1-21Course materials may not be reproduced in whole or in partFigure 1-8. Performance Analysis Flowchart AU187.0 Notes:Tuning is a processThe flowchart in the visual above can be used for performance analysis and it illustrates that tuning is an iterative process. We will be following this flowchart throughout our course.The starting point for this flowchart is the Normal Operations box. The first piece of data you need is a performance goal. Only by having a goal, or a set of goals, can you tell if there is a performance problem. The goals may be something like a specific response time for an interactive application or a specific length of time in which a batch job needs to complete. Tuning without a specific goal could in fact lead to the degradation of system performance.Once you decide there is a performance problem and you analyze and tune the system, you must then go back to the performance goals to evaluate whether more tuning needs to occur.© Copyright IBM Corp. 2000, 2006Unit 1. Performance Analysis and Tuning Overview1-27Course materials may not be reproduced in whole or in partAdditional testsThe additional tests that you perform at the bottom right of the flowchart relate to the four previous categories of resource contention. If the specific bottleneck is well hidden, or you missed something, then you must keep testing to figure out what is wrong. Even when you think you’ve found a bottleneck, it’s a good idea to do additional tests to identify more detail or to make sure one bottleneck is not masquerading as another. For example, you may find a disk bottleneck, but in reality it’s a memory bottleneck causing excessive paging.1-28 AIX 5L System Administration III© Copyright IBM Corp. 2000, 2006Course materials may not be reproduced in whole or in partFigure 1-9. Performance Analysis Tools AU187.0 Notes:CPU analysis toolsCPU metrics analysis tools include:-vmstat, iostat, sar, lparstat and mpstat which are packaged with bos.acct -ps which is in bos.rte.control-cpupstat which is part of mands-gprof and prof which are in bos.adt.prof-time (built into the various shells) or timex which is part of bos.acct-emstat and alstat are emulation and alignment tools from bos.perf.tools-netpmon, tprof, locktrace, curt, splat, and topas are in bos.perf.tools-trace and trcrpt which are part of bos.sysmgt.trace-truss is in bos.sysmgt.ser_aids1-30 AIX 5L System Administration III© Copyright IBM Corp. 2000, 2006Course materials may not be reproduced in whole or in partInstructor Guide-smtctl is in bos.rte.methods-Performance toolbox tools such as xmperf, 3dmon which are part of perfmgr Memory subsystem analysis toolsSome of the memory metric analysis tools are:-vmstat which is packaged with bos.acct-lsps which is part of bos.rte.lvm-topas, svmon and filemon are part of bos.perf.tools-Performance toolbox tools such as xmperf, 3dmon which are part of perfmgr-trace and trcrpt which are part of bos.sysmgt.trace-lparstat is part of bos.acctI/O subsystem analysis toolsI/O metric analysis tools include:-iostat and vmstat are packaged with bos.acct-lsps, lspv, lsvg, lslv and lvmstat are in bos.rte.lvm-lsattr and lsdev are in bos.rte.methods-topas, filemon, and fileplace are in bos.perf.tools-Performance toolbox tools such as xmperf, 3dmon which are part of perfmgr-trace and trcrpt which are part of bos.sysmgt.traceNetwork subsystem analysis toolsNetwork metric analysis tools include:-lsattr and netstat which are part of .tcp.client-nfsstat and nfs4cl as part of .nfs.client-topas and netpmon are part of bos.perf.tools-ifconfig as part of .tcp.client-iptrace and ipreport are part of .tcp.server-tcpdump which is part of .tcp.server-Performance toolbox tools such as xmperf, 3dmon which are part of perfmgr-trace and trcrpt which are part of bos.sysmgt.trace© Copyright IBM Corp. 2000, 2006Unit 1. Performance Analysis and Tuning Overview1-31Course materials may not be reproduced in whole or in partInstructor GuideAIX 5L V5.3 enhancements to analysis toolsSeveral changes were made in AIX 5L V5.3 to the analysis tools. Changes were made at different maintenance levels for V5.3.The tprof command has new -E option to enable event based profiling and the new -f option allows you to set the sampling frequency for event-based profiling. There were updates to PMAPI including updates to pmlist and there are two new commands for hardware analysis: hpmcount and hpmstat. These are not covered in this course.The topas command has a new -D panel for disk analysis.There are new commands for obtaining statistics specific to a logical partition. These give statistics for POWER Hypervisor activity or for tracking real CPU utilization in a simultaneous multi-threading or shared processor (Micro-Partition) environment. A new register was added called the Processor Utilization Resource Register (PURR) to track logical and virtual processor activity. Commands such as sar and topas willautomatically use the new PURR statistics when in a simultaneous multi-threading or shared processor (Micro-Partition) environment and you will see new columns reporting partition statistics in those environments. Trace-based commands now have new hooks for viewing PURR data. Some commands such as lparstat, mpstat, and smtctl are new for AIX 5L V5.3 and work in a partitioned environment.The AIX 5L Virtualization Performance Management course covers all differences in performance analysis and tuning in a partitioned environment.1-32 AIX 5L System Administration III© Copyright IBM Corp. 2000, 2006Course materials may not be reproduced in whole or in partInstructor GuideFigure 1-10. Performance Tuning Process AU187.0 Notes:OverviewPerformance tuning is one aspect of performance management. The definition ofperformance tuning sounds simple and straight forward, but it’s actually a complex process.Performance tuning involves managing your resources. Resources could be logical (queues, buffers, etc.) or physical (real memory, disks, CPUs, network adapters, etc.).Resource management involves the various tasks listed here. We will examine each of these tasks later.Tuning always must be done based on performance analysis. While there arerecommendations as to where to look for performance problems, what tools to use, and what parameters to change, what works on one system may not work on another. So there is no cookbook approach available for performance tuning that will work for all systems.The wheel graphic in the visual above represents the phases of a more formal tuning project. Experiences with tuning may range from the informal to the very formal where reports and reviews are done prior to changes being made. Even for informal tuning actions, it is essential to plan, gather data, develop a recommendation, implement, and document.Figure 1-11. Performance Tuning Tools AU187.0 Notes:CPU tuning toolsCPU tuning tools include:-nice, renice, and setpri modify priorities.nice and renice are in the bos.rte.control fileset.setpri is a command available with the perfpmr package.-schedo (schedtune in AIX 5L V5.1) modifies scheduler algorithms (in the bos.perf.tune fileset).-bindprocessor binds processes to CPUs (in the bos.mp fileset).-chdev modifies certain system tunables (in the bos.rte.methods fileset).-bindintcpu can bind an adapter interrupt to a specific CPU (in thedevices.chrp.base.rte fileset).-procmon is in bos.perf.gtools.Instructor GuideMemory tuning toolsMemory tuning tools include:-vmo and ioo (vmtune in AIX 5L V5.1) for various VMM, file system, and LVM parameters (in bos.perf.tune fileset)-chps and mkps modify paging space attributes (in bos.rte.lvm fileset)-fdpr rearranges basic blocks in an executable so that memory footprints become smaller and cache misses are reduced (in perfagent.tools fileset) -chdev modifies certain system tunables (in bos.rte.methods fileset)I/O tuning toolsI/O tuning tools include:-vmo and ioo modify certain file system and LVM parameters (in bos.perf.tune fileset) (Use vmtune prior to AIX 5L V5.2.)-chdev modifies system tunables such as disk and disk adapter attributes (in bos.rte.methods fileset)-migratepv moves logical volumes from one disk to another (in bos.rte.lvm fileset) -lvmo displays or sets pbuf tuning parameters (in bos.rte.lvm fileset)-chlv modifies logical volume attributes (in bos.rte.lvm fileset)-reorgvg moves logical volumes around on a disk (in bos.rte.lvm fileset)Network tuning toolsNetwork tuning tools include:-no modifies network options (in .tcp.client fileset)-nfso modifies NFS options (in .nfs.client fileset)-chdev modifies network adapter attributes (in bos.rte.methods fileset)-ifconfig modifies network interface attributes (in .tcp.client fileset)CPU在定位CPU性能问题时,从监视 CPU 使用率的统计数据入手。
基于AIX系统的自动监控的运行性能优化及应用研究
基于AIX系统的自动监控的运行性能优化及应用研究摘要 aix是ibm公司pc机型机专用的unix操作系统,本文主要通过不同的分析方法, aix操作系统为主要运行平台,对与aix系统运行性能相关的网络子系统主要方面分别进行了深入探讨,结合分析和优化方法对基于aix系统的自动监控系统进行了具体的性能分析并提出了优化方案,并取得了较好的优化效果,能够保障企业计算机系统运行的高效性能。
关键词 pc机;aix操作系统;自动监控;性能优化中图分类号tp39 文献标识码a 文章编号1674-6708(2010)31-0209-02计算机自动监控系统的运行性能优化及应用是一项综合性的复杂工作,应考虑cpu处理能力,内存的大小、数据冗余与数据存储的能力等多个方面,尽量优化每个部件,才能充分保障计算机自动监控系统运行的高效,可靠和安全。
因此,对系统性能进行分析和优化,对企业的信息化建设有一定的指导作用。
本文为此主要针对pc机网络子系统探讨基于aix系统的自动监控运行性能优化及应用方法。
1 pc机网络子系统自动监控介绍pc机网络子系统自动监控由nfs,nis,samba等几部分组成等。
其中nfs是实现两机间进行通讯访问的一种简单方法,nfs本身的服务并没有提供资料传递的协议,但是它却能进行文件的共享。
原因就是nfs使用到一些其它相关的传输协议,而这些传输的协议就是远程过程调用(rpc)。
nfs也可以视为一个rpc server。
需要说明的是,要挂载nfsserver的client pc主机,也需要同步启动远程过程调用。
这样server端和client端才能根据远程过程调用协议进行数据共享。
网络信息服务nis则是一种集中管理系统通用访问文件的分布式数据库系统,在嵌入式linux实验过程中,我们通过配置nfs实现pc机和实验箱arm-linux平台之间的访问。
原理是在pc 机linux中开启nfs服务,设置一个共享目录(这里是/arm2410),所有的源码编辑改动都可以在pc机中进行方便的修改,在arm-linux 实验环境中,将pc-linux的/arm2410目录远程mount到本地,实现两机间的同步读写访问,这样程序就可以方便的在arm-linux中运行测试。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
AIX 5L 性能优化,第1 部分: 监视CPU关于本系列本系列文章由三部分组成,重点介绍中央处理器(CPU) 性能和监视的各个方面。
本系列文章的第一部分概述了有效监视CPU 的方法,讨论性能优化的方法,并从正反两方面考虑可能影响性能的因素。
本系列文章的第一部分虽然详细说明了一些命令,但第二部分将更集中于实际CPU 系统监视的细节,以及分析趋势和结果。
第三部分则专注于通过主动控制线程使用和其他方法在最大程度上优化您的CPU 性能。
在整个系列文章中,我还将详细说明AIX® CPU 性能优化和监视方面的各种最佳实践。
引言作为一名AIX 管理员,您应该已经了解性能优化的一些基础知识。
您很可能已经在使用各种命令,如vmstat 或topas,并且熟悉识别占用大量CPU 资源的进程的方法。
有一点您可能并不了解,CPU 性能优化不仅仅是关于运行某些命令,它还涉及主动监视您的系统,特别是在不存在性能问题时。
本文介绍CPU 性能优化的方法,并提供经过时间验证的步骤,可以帮助您完成整个优化过程。
在本文中,我将介绍您可能希望使用的一些监视工具,概述POWER 芯片和可能会影响性能的考虑因素。
即使对于大多数资深管理员来说,虚拟化环境中的性能也带来了一种挑战,因此我还会详细说明虚拟化环境中的特定问题,包括同步多线程(SMT)、虚拟处理器以及POWER Hypervisor。
我还将讨论在调整CPU 的过程中需要特别关注的领域,包括调整调度程序、平衡系统负载,以及更改调度程序的算法以优化优先级公式。
在调查性能问题时,从监视CPU 使用率的统计数据入手。
持续观察系统的性能非常重要,这是因为需要对过载的系统数据与正常使用的数据(作为基准)进行比较。
因为CPU 是系统中最快的组件,因此如果CPU 使用率使CPU 保持100% 忙碌,那么也会影响系统范围的性能。
如果发现系统使CPU 保持100% 忙碌,则需要调查导致这种情况发生的进程。
AIX 提供了许多分别针对系统和进程(或同时针对系统和进程)的跟踪和分析工具。
在CPU 受限的系统中,所有处理器都是100% 忙碌的,并且一些作业可能正处在运行队列中等待CPU 时间。
通常来说,如果某个系统的CPU 是100% 忙碌,并且相对于CPU 的数目来说拥有大规模的运行队列,以及具有更为频繁的上下文切换,那么该系统很有可能成为CPU 受限系统。
这是快捷但非恰当的判断方法,并且我敢确定您会发现更多的判断方法。
优化方法在本部分中,我们将了解几种AIX 优化的方法。
建立基准在优化乃至启动监视之前,必须先建立一个基准。
基准是当系统运行良好时的情况快照。
基准不应该仅仅捕获性能类型的统计数据,还应该记录系统的实际配置(内存大小、CPU 数量以及硬盘容量)。
如果不记录系统配置,则无法进行同类比较。
这在分区系统中尤为重要,您可以在极短时间内进行动态逻辑分区(DLPAR)。
要得到适当的基准,您需要确定监视所使用的工具。
有许多可供您在AIX 5.3 中使用的工具,其中一些工具更适用于分区和虚拟化环境(例如,lparstat 和mpstat)。
一些更通用的工具通常可用于所有版本的UNIX®,其中包括vmstat、sar 和ps。
还有一些AIX 专用的实用工具,包括topas、procmon,以及一些部分受支持的工具,如nmon。
如果您已经确定了监视工具,就需要开始收集统计数据和性能度量数据。
这有助于定义给定系统的可接受性能水平。
再次重申,应该在接听可怕的电话之前开始跟踪问题。
您需要了解运行良好的系统所表现的特点。
还应该与相应的应用和功能团队协作确定运转良好的系统的精确定义。
此时,您可以将该定义转换为服务水平协议(SLA),准备征得客户的正式同意。
压力测试和监视此方法的第二步是压力测试和监视部分。
现在需要监视系统在高峰负载和故障期间的情况。
这有助于准确确定系统的问题所在。
这确实是CPU 瓶颈,还是与内存或I/O 的关系更为密切?在此步骤中,我喜欢使用多种监视工具来帮助验证所发现的问题。
我可能使用交互式工具(如vmstat),然后使用捕获工具(如nmon)来帮助我跟踪数据历史记录。
此监视步骤非常关键,因为如果没有准确记录系统运行(特别是承受压力期间)的历史数据,就无法有效地优化任何功能。
此时建立系统的性能策略非常重要。
您可以在监视过程中制定相关措施,并根据历史数据对这些措施进行分析,然后在压力测试阶段进一步分析。
识别瓶颈对系统进行压力测试和监视的目的是为了确定瓶颈。
若不作出正确诊断,就无法对症下药。
如果系统实际上是CPU 受限的,就可以运行其他工具(如trace、curt、splat、tprof 和ps)来进一步确定导致瓶颈的实际进程。
还有可能您的系统实际上是内存或I/O 受限,而非CPU 受限。
修复某个瓶颈可能会导致CPU 瓶颈,这是因为系统现在允许CPU 以最佳化性能运行,而CPU 本身可能没有能力处理额外增加的资源量。
我经常看到这种情况出现,这不一定是一件坏事。
恰恰相反,它最终可以帮助您隔离所有的瓶颈。
您会发现监视和优化系统是一个极具变化的过程,且并非总是可以预测的。
这就是让性能优化变得如此具有挑战性的原因。
优化瓶颈在您最终确定瓶颈之后,就到了对瓶颈进行调整的时候了。
对于CPU 瓶颈,通常有四种解决方案可供选择:∙平衡系统负载——在不同的期间运行进程,从而更有效地利用每天的24 小时。
∙使用nice 或renice 优化调度程序——可帮助您为运行进程分配不同的优先级,以避免占用大量CPU 资源。
使用schedo 调整调度程序算法,从而优化优先级公式——可以使用schedo 调整AIX 中的各种参数。
例如,schedo 命令可用于更改操作系统在调用调度程序以选择运行其他进程之前允许给定进程运行的时间(时间片)。
此时间间隔的默认值为单个指令周期(10 毫秒)。
时间片调整参数允许用户指定时间片长度增加的时钟计时数。
清单1. 时间片调整参数# schedo -a | grep timeslicetimeslice = 1∙增加资源——添加更多的CPU,或者在虚拟化环境中重新配置您的逻辑分区(LPAR)。
这可能包括设置无上限分区或向现有分区添加更多的虚拟处理器。
适当地虚拟化您的分区环境有助于提高物理资源使用率,减少特定LPAR 上的CPU 瓶颈,以及减少任务不繁忙的LPAR 上的空闲容量的开销。
其他一些CPU 调整命令包括smtct、bindintcp 和bindprocessor。
重复现在必须再次逐步完成此过程,从压力测试和监视部分的第二步开始。
只有通过重复测试和持续监视您的系统,才能确定调整是否确实起作用。
我了解一些管理员仅仅是基于针对特定应用程序的最佳实践调整某些参数,然后就开始进行其他工作了。
最糟糕的事情莫过于此。
首先,在其他环境中有效的调整也许并不适合您的环境。
更重要的是,如果不观察数据,您如何能确实了解所作的调整是否有助于解除瓶颈?再次重申,AIX 性能优化是动态的过程,为了切实获得成功,您需要持续监视您的系统,而这只有在建立基准和SLA 之后才能实现。
如果不能定义运行良好的系统的行为,那么您如何能够定义运行不佳的系统的行为?如果等到您接到前面提到过的电话才进行这些工作,恐怕为时已晚。
CPUPOWER 体系结构表示带有增强的Risc 功能的“功率优化”,并且是当今IBM 中型服务器所使用的处理器。
它是801 CPU 的衍生产品,也是第二代基于RISC 的处理器。
它最初于1990 年推出,用于支持UNIX RS6000® 系统。
POWER4 是首款64 位对称多处理器,于2001 年发布。
它成为IBM Regatta 服务器的内在驱动力量,并支持逻辑分区。
POWER5 体系结构于2003 年推出,每个处理器包含2.76 亿个晶体管。
POWER5 基于130 纳米铜和绝缘硅(SOI) 工艺,并具有以下特性:∙芯片多处理∙更大的缓存∙芯片上集成内存控制器∙SMT∙高级电源管理∙改进的Hypervisor 技术POWER5 的设计支持多达256 个LPAR,并且可同时用于它的pSeries® 和iSeries™ 服务器。
这一采用SMT 技术的双核处理器是利用SOI 设备和铜互连技术制造的。
SOI 技术用于减少器件电容和提高晶体管性能。
POWER5 实际上是IBM 第二代双核微处理器芯片,并且为支持更细粒度和更灵活的分区提供了创新和改进的功能。
此外,它还分别使用双芯片模块(DCM) 和多芯片模块(MCM) 作为其中端服务器和高端服务器的基本构建块。
POWER5 芯片的一些更重要的创新还包括:∙增强的内存子系统∙改进的L1 缓存设计∙新的替换算法(LRU 与FIFO)∙更大的L2 缓存∙ 1.9 MB,10 路集相关∙改进的L3 缓存设计∙允许L2 缓存更高的未命中率∙避免在芯片结构之间通信∙芯片上L3 目录和内存控制器∙芯片上L3 目录可以减少发生L2 未命中之后的离片延迟∙改进的预取算法∙增强的性能∙SMT∙对微分区的硬件支持也许POWER5 处理器的最重要创新包括对微分区和SMT 的支持,这同样需要得到AIX 5L Version 5.3 的支持。
微分区提供在多个分区之间共享单个处理器的能力。
这些分区被称为共享处理器分区。
当然,基于POWER5 的系统继续支持具有专用处理器的分区,这类分区不与其他分区共享单个物理处理器。
在共享分区环境中,POWER Hypervisor 为共享分区调度和分配来自一组物理处理器的处理器权限。
该物理处理器集合被称为共享处理器池。
处理器权限在每轮Hypervisor 的调度循环中进行分配。
在每个轮次中,分区消耗或放弃被授予的处理器权限。
图1显示了在微分区环境中的共享和专用分区的示例。
图 1. 在微分区环境中的共享和专用分区的示例SMTSMT 能够在单个物理处理器上并行调度来自多个硬件线程的指令。
在AIX 5L Version 5.3 中,使用一个物理处理器创建的专用分区实际上被默认配置为逻辑 2 路。
从本质上讲,两个硬件线程实际上可以同时在一个物理处理器中运行。
虽然存在一些独立环境,在其中调整SMT 可能对性能造成负面影响,但是SMT 在大多数情况下都是最佳选择,特别是在整体吞吐量比单个线程的吞吐量更重要时。
作为POWER5 的独特双核设计和对SMT 支持的结果,一个POWER5 芯片对于操作系统实际上表现为4 路微处理器。
使用SMT 技术的处理器可以在单个周期中发出多个来自不同代码路径的指令。
图2是DCM 的图示,清晰地显示了SMT 和芯片自身的关系。
图 2. 双芯片模块让多个线程在不同的CPU 上面运行允许有效利用IBM SMT 技术。