系性分析与调优.doc_第1页
系性分析与调优.doc_第2页
系性分析与调优.doc_第3页
系性分析与调优.doc_第4页
系性分析与调优.doc_第5页
已阅读5页,还剩25页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

系性分析与调优什么是性能?性能是系统生产能力依赖于的一个主要的决定因素性能是依赖于响应时间和吞吐量的共同作用的结果系统性能的组件CPU(Central Processing Unit)resources处理器速度,个数软件控制CPU序列的性能Memory resourcesRAM速度,容量,缓存,虚拟内存I/O resources磁盘潜伏期,有多少个磁盘,输入/输出适配器设备驱动与内核性能Network resources网络适配器的性能,包括物理网络本身软件性能的网络应用系统调优过程界定和优先次序,具体的绩效目标确定性能瓶颈确定所需的资源(逻辑或物理)最大限度地减少资源需求 使用适当的资源 结构并行资源利用率控制资源的分配性能度量衡量绩效,通过使用分析工具每个度量可分为精细 cpu使用率,可分为用户, 系统, 闲置, IO等待 内存度量包括虚拟内存调页统计, 文件调页统计,缓存 磁盘输入/输出度量包括千字节读/写,交易每秒,完整的IO时间输入/输出,磁盘适配器统计 网络度量包括千字节转每秒传输统计数据,网络存储器利用率性能分析工具性能调优工具Topas 命令一个性能监控工具,是理想的广谱性能分析cpu使用率CPU事件与队列内存与页面使用磁盘性能网络性能CPU监测与分析目标微分区&SMT进程和线程优先次序和调度工作标准的AIX工具决定CPU瓶颈输出结果和报告生成工具显示技术调校整体系统SMT同步多线程由一个以上的线程获取指示power5的设计实现了双路SMT在一颗芯片的两个处理器核心在SMT模式,power5处理器采用了两个独立的程序处理,每组一个线程并非所有的应用程序受益于SMT技术SMT 和 AIX5LAIX5L V5.3动态地交换在ST 和SMT 方式之间 (无需重启)Smtctl命令必须运行在root用户帐户 -m off 设置关闭SMP模式 -m on 设置开户SMP模式 -w boot 使SMT模式转变为重启后有效并随后重启 -w now Makes the mode chCPU 性能处理器时钟速度表示为megahertz(兆赫) 1兆赫,是百万中央处理器赫兹,即1秒钟处理1百万次运算# lsattr -E -l proc0 -a frequency 中央处理器周期是区间需要执行的运算中央处理器执行时间 =(多少赫兹指示*指令数)/ 处理器时钟速度针对于系统性能,高时钟速度都只是其中的一部分cpu性能;中央处理器结构和系统设计,可以存在很大差异, 进程和线程的优先次序当多线程正在运行时,一个优先事项是多少分配给一个线程用于确定命令的调度优先号码范围从0-255 0被认为是最好,而255则为最低(255是保留给等待/闲置内核线程)一个进程的优先权会更优于任何一个它的线程优先权限继续于父进程优先号码小于40的视为是实时优先CPU调度策略SCHED_RR轮循的调度,运行于固定优先一直持续到时间切片的结束,或由更好的优先级线程先占有SCHED_FIFO首先,先出调度运行在固定优先非更好优先级线程则不会抢占SCHED_OTHER默认的调度策略同时,作为sched_rr但适用线程与非固定优先优先将依据cpu使用率查看CPU优先查看线程优先更改优先级优先次序是可以改变的,由线程本身 thread_setsched() or setpri() system calls优先次序是可以改变的,由一个用户 nice, renice, or programs that call thread_setsched() or setpri()优先次序可能会由内核通过其调度算法更改优先次序可能会由工作负载管理更改Nice 价值与命令好值是一个优先调整因子加入到基本用户的优先权40的非固定优先线程好的价值被继承从父进程。第一过程在系统(init) 有好的价值的20 和 因此一种有效的优先权60好值可以为0-40 usage: nice -n increment command usage: nice -increment command增量的价值被添加到目前的价值(即该进程的引用Nice命令)Renice 命令当一个进程已经建立,其nice价值可由renice命令更改Renice 语法:usage: renice -n increment | increment -g| -p| -u ID.Nice价值是减少使用负面增量值,并增加了积极的增量价值减少Nice价值,使用更多的优先权越来越多的Nice价值使得优先权较少被考虑进程和线程优先SCHED_OTHER 线程优先的更改初始化优先 = 基本优先权( 40 )+ Nice值(默认为20 ,范围0-40)Base priority + NICE,也被称为niced优先执行的线程(p_nice)AIX 5L当cpu时钟中断发生时,会使用公式重新计算线程优先级 recalculated priority = x_nice + (C * r/32 * X) p_nice = 40 + NICEif NICE is less than or equal to 20, then x_nice = p_niceif NICE is greater than 20, then x_nice = (p_nice* 2) - 60 C is recent CPU usage r/32 is the CPU penalty factor (r value defaults to 16, r is tunable (with schedtune or schedo) and can range from 0-32) X = (x_nice + 4)/64 priority is limited to maximum of 126 (AIX 4) or 254 (AIX 5)调节CPU使用率因子中央处理器的处罚到最近的中央处理器-使用比率表示为r/32 smaller values of r narrow the priority range and makes NICE value more of an impact on the priority larger values of r widen the priority range and makes NICE value less of an impact on the priority价值r的是可以改变的,动态使用 #schedo -o sched_R=r值可以从0-32调节cpu使用率老化因子最近中央处理器使用的老化因子表示为d/32 smaller values of d age CPU usage at a faster rate and can causeCPU intensive threads to be scheduled sooner larger values of d age CPU usage at a slower rate and penalizes CPU intensive threads more (thus favoring interactive-type threads)D值是可以改变的,动态使用 #schedo -o sched_D=价值的d默认为16,范围可以从0 -32例如优先计算调节CPU的时间片每个cpu是分担线程,分别执行了线程某些时间的切片每个时间切片的单位的时钟(10ms)默认的时间切片为1clock,并可以调节 # schedo -o timeslice=有时增加时间切片减少上下文切换并节省了计算时间,来实现更少的上下文切换开销调节CPU亲和力约束一个进程bindprocessor命令的语法 #bindprocessor Processid ProcessorNum | -q | -u Processid查询所提供的处理器-逻辑号码 # bindprocessor -q约束过程及其相关线程处理器 # bindprocessor 释放过程及相关线程处理器 # bindprocessor -u 监测cpu使用率与vmstatUsage: vmstat -ifsIlvt drives interval count $ vmstat 5 3如果运行的线程除以中央处理器的数量大于1时,可能会有一个中央处理器瓶颈 确定谁使用中央处理器如果us+ sy= 100%, 那么将会出现一个CPU瓶颈 特有的cpu使用率(高级用户或高级系统) 审查中断,系统调用,上下文交换率监测cpu使用率与vmstatcpu使用率中vmstat标题及其说明 r - 运行的内核线程平均数 in - 每秒的设备中断 sy - 每秒的系统调用 cs - 每秒的上下文切换 us - CPU在用户模式上花费的时间百分比 sy - CPU在系统模式上花费的时间百分比 id - CPU被闲置时间百分比 wa - 中央处理器时间被闲置百分比,并有至少一个输入/输出程序监测cpu使用率与sar数据类型 所有数据类型的收集;仅准许特定数据类型报告Timing Intervals: the extraction interval can differ from the collection interval权限:必须在系统组sadc: 后端为sar,负责数据收集显示sar命令的统计特性Sar命令 Collection: sar -o filename 60 300 /dev/null & Extraction: sar -A -f filename Extraction: sar -u -f filename -s 10:20 -e 14:50 Monitoring: sar -c 60 300 Gives information on individual processors: sar -P ALL 5 1定位主导进程哪些进程正在使用最多的中央处理器? 运行周期(使用ps命令)# ps aux or# ps vx 运行一段时间内# tprof -x sleep 60 使用其它的工具例如 $topas有可能不是以某一个或几个进程中的主导CPU用法-高cpu使用率,可以总结的许多进程Ps命令tprof - AIX 5.2 and laterPthreads 范围调节pthreads library used to implement user-level threads A multi-threaded user program can have many user threads and either as many or fewer kernel threads. User threads are mapped to kernel threads by the pthreads library.Thread model can be set via an environment variable AIXTHREAD_SCOPE=S sets model to 1:1 can provide better performance when number of user threads is not very large or when running on an SMP system AIXTHREAD_SCOPE=P sets model to M:N can provide better performance when there are a very large number of user threads or if running on a uniprocessor systemLparstat监视工具New command to show partition level information configuration performance dataWorks on all hardware supported by AIX 5.3 for non LPAR machine - displays only utilization for dedicated partition - optionally shows hypervisor statistics for shared partition - full functionalityThree modes of operation information (-i) -shows static configuration information detailed hypervisor (-H) -shows breakdown of hypervisor time by hcall type monitoring mode (default)lparstat -配置信息的示例lparstat -监测模式度量展示cpu使用率(%user, %sys, %idle, %wait)percentage spent in hypervisor (%hypv) and number of hcalls (hcalls) both optionaladditional shared mode only metrics Physical Processor Consumed (physc) Percentage of Entitlement Consumed (%entc) Logical CPU Utilization (%lbusy) Available Pool Processors (app) if the partition has the authority to retrieve information number of virtual context switches (vcsw) virtual processor hardware preemptions number of phantom interrupts (phint) interrupts received for other partitionsLparstat 命令示例Mpstat 命令显示每个逻辑处理器的详细信息多达29个新的度量(当使用-选项) 单位数目每秒或百分比默认模式显示 利用度量(%user, %sys, %idle, %wait) 主要和次要页故障(有无磁盘输入/输出) 若干系统调用 中断的数量when SMT is on or running in shared mode, one column is added fraction of physical processor consumedwhen running in shared mode, two more columns are added percentage of entitlement consumed number of logical context switchesmpstat 命令 - 详细选项-d 显示详细的软件和硬件调度员度量-i 显示详细中断度量-s 显示STM利用率Mpstat 命令该mpstat命令收集并显示在一个分区内所有逻辑处理器的性能状态全系统工具改装的虚拟化 Physical processor consumed by the partition, shown as pc or %physc. Percentage of entitled capacity consumed by the partition, shown as ec or %entc. Related commands are vmstat, iostat, sar, topas内存监测与分析目标解释基本虚拟内存概念和哪些东西影响性能解释页面替换利用vmo以调节页面替换vmm监测和校正工具解释如何分析内存使用虚拟内存的概念 Allows every process to function like it is the only process on the system Removes developer concerns about what is running on the system outside of their individual program Saves memory by allowing holes,in physical memory assigned 32 bit processes can have 16 segments: 0-F 64 bit processes can have up to 236 possible segments(note: this requires 64 bit hardware) AIX 5L supports multiple page sizes: 4k/64k/16M/16G4k pages are supported on all platforms All other pages sizes are platform dependant A single segment references 256MB of address spaceComputational vs File MemoryVMM技术两种类型的内存1计算Process Stack (grows down), Heap (grows upward), Shared memorySubstantiated by Page Space (Swap Space)Remains in memory until: Process Terminates (physical and paging space released) Page is Stolen (paging space is allocated and physical page is released)2文件JFS, JFS2, NFS, VeritasSubstantiated By File SystemRemains in memory until: File is unmounted Page is stolen File is unlinked and no references to the file are left openVMM Memory SegmentsVMM Segment TypesWorkingKernel - segment is used in kernel space and is addressable by all processes - kernel and applicationText/shared library text - Contain executable code Not modifiable except through debuggers Normally shared by multiple processesData - typically not shared and private to a single processmbuf - Network memory segmentsClient - Non-JFS file segment - JFS2/NFS/Veritas/etcExternalized from the kernelPersistent - JFS file segmentTightly integrated with the kernelAIX的内存管理回顾lateAllocation of MemoryComputational Allocation No Allocation when memory is requested Allocated on page boundary when actually usedPage Space Allocation Page space not allocated until memory is paged out Page space not released until dereference by process terminating or address space is disclaimedFile Allocation File page allocation when file page is read or written Not released unless page is stolen, file is unmounted or unlinked/deleted页面替换参数minfree and maxfree are tunables that determine when freeing starts and stops.Minperm%, maxperm% and maxclient % are tunables that affect what types of pages are stolen.numperm and numclient are measurements of the number of file pages and client pages in use.strict_maxclient or stict_maxperm are set a hard limit on maxclient% or maxperm%页面替换基础Page replacement is the process of freeing pages in real memory by scanning the Page Frame Table (PFT) for pages to stealPage replacement starts if The number of free memory pages gets low (minfree threshold) The number of cached file pages gets close to its strict limit (maxclient for client pages and maxperm for JFS pages if strict_maxperm is enabled)Page replacement stops when The number of free memory pages reaches the maxfree threshold The number of cached file pages equals (maxclient - maxfree) for client (JFS2, NFS, CD-ROM FS) (maxperm - (maxfree - minfree) for JFS页面替换When a process exits, its working storage is freed up immediately and its associated memory frames are put back on the freelist; however, any files the process may have opened can stay in memory页面替换过程调节JFS2文件内存缓存JFS2 pages are allocated from the client segment The upper limit for client pages is based on the maxclient% parameter Once the number of client pages in memory reaches maxclient%, page replacement is started on the client pages. JFS2 will compete for client pages with other client segments such as compressed or NFS client segmentsIf VMM freelist reaches minfree, working storage pages may get paged out To reduce the likelihood of replacing working storage pages due to a large amount of JFS2 pages in RAM, reduce the maxclient parameter vmo -o maxclient%=调节vmm参数举例来说,要改变maxclient至40 : # vmo -o maxclient%=40设定改变在机器重启后运行: # vmo -r -o maxclient%=40Detuning VMM page replacementInaccurate use of vmo can result in bad performance or system hangNever tune a machine based on general recommendationsWhat you should not do Do not increase minfree and maxfree without reducing maxperm% and maxclient% if the system shows heavy paging activity Do not enable strict_maxperm on small memory machines Do not change the number of memory pools or framesets without a good reason调页活动主要用于工作存储页面,有一些罕见例外Pages can be stolen and their contents are copied to paging space on a page by page basis如果该页面是被引用,当一个页面故障出现, 由调页空间将页面被拷贝回到内存, 页可能被分配在真正的内存上, 在一个或两个调页空间这些细节由XPT 处理应用没有对调页的直接控制页空间分配算法延期的页空间分配(D.P.S.A) This is most common on systems with very large amount of RAM. Deferred Page Space Allocation policy will delay allocation of paging space until it is necessary to page out the page - which results in no wasted paging space allocation. This can save huge amounts of paging space. vmo -o defps= will turn off/on D.P.S.A.页面空间的默认大小缺省调页空间大小是由的在系统定制阶段的AIX 安装期间并根据以下标准决定:调页空间可能使用少于20% 总磁盘空间如果实际内存小于256兆,页面空间相当于第两个的真实内存如果实际内存大于等于256兆,页面空间为512兆页面空间逻辑卷使用磁盘或最少被使用的磁盘每个物理盘不要分配超过一个调页空间逻辑容量避免与别人共用相同的磁盘与日志逻辑卷如果可能, 使所有调页空间相同大小使用lsps 命令检查调页空间运用查看内存瓶颈与vmstatVmstat 命令 vmstat 1 5 vmstat -I 1 5 vmstat -s (for paging and system events since initialization) vmstat -f (# of forks since initialization) vmstat -v使用ps查看内存利用率Svmon 命令虚拟内存的分析工具目的:抓取一个当前内存状态的快照信息显示可能被分析使用四个不同报告 global -G process -P segment -S detailed segment -Dsvmon -G-全局的总览所有环节都清点及分类调页空间的利用被总结The total number of memory frames needed to working segments (everything except file cache) is the value under virtualand is the number of 4k pages needed for working storage. This should be approximately equal to AVM column of vmstatFile system cache in use is determined by adding pers and clnt in use valuessvmon -S - A system wide viewsvmon -P View from the process相关vmstat和svmon输出内存泄漏造成这个程序反复分配内存,没有释放它照样可以造成严重系统页面性能降低可由svmon检测C Set+提供了一个调试分析/调节内存使用和泄漏的概览第三方工具,也可用于分析内存泄漏分析内存泄漏与svmon这些都真的指的是什么?一个进程用多少内存?确定私人数据代码共享库进程共享内存系统环节(这些通常是未包含)输入/输出监测与分析为什么是磁盘IO的调节很重要?磁盘增长 磁盘密度增加一倍,每12个月 用户成倍增长的存储容量每12个月 驱动器和转速增加相对缓慢内存的访问花费540个CPU周期磁盘存取需二千万中央处理器周期,或37037内存访问周期系统瓶颈正在被推向磁盘用户在存储上的花费要高于服务器存储层次I/O路径磁盘存储子系统服务器附加存储存储区域网络网路附加储存数据布局数据布局对IO的影响大于任何可调节参数的IO 良好的数据布局,避免处理磁盘热点 一项持续的管理问题和成本数据布局,必须预先策划好的 变动一般是痛苦的随机IO的最佳做法散布均匀,内部监督所有物理磁盘磁盘子系统 创建同等大小和类型的阵列 在每一个阵列上的LUN创建VG VG中的所有PV都包含LV数据布局LVM限制逻辑卷属性的性能影响表现 PV中的位置(内部策略) PV的范围(最小或最大) 使用PV的最大个数 每个LP的copy个数(镜像) 镜像写一致性(关闭,激活还是被动) 分配每个LP拷贝到多个PV上(是,否或superstrict) 在整顿期间调迁LV(是,否) 写LV拷贝预定的调度策略(p, ps, pr, s) 开启写校验(是,否) 连续的逻辑卷输入/输出(是或否/AIX 5.2 and later)LVM镜像lvm的镜像容许个别逻辑卷镜像,而不是一个整个磁盘。镜像属性包括:如果镜像写的一致性,为Yes或Active时,镜像操作有利于读取性能,但降低了写性能, LVM Partition Striping当每一个条带单位是一个PP时,一个LV会被条带化分散在多个磁盘上分区的条带化可以:指明磁盘驱动器,将用来为逻辑卷指明的物理卷的范围为最高如果PP大小是非常大的,那么数据可能不扩散以及数据块条带化在这种情况下,不推荐用于纯粹顺序输入/输出,因为数据块条带化,将更好地开展工作, 使用iostat监视IO自从系统启动的第一份报告(if sys0s attribute iostat=true)审查磁盘的IO平衡各方面寻找突发的IO (based on syncd interval)用法:Monitor IO using iostat command监测适配器输入/输出吞吐量iostat -a 显示适配器吞吐量盘是列出的跟随他们附有的适配器使用sar命令的-d选项使用filemonfilemon报告文件, vmm部分,逻辑和物理卷状态用法:filemon -o file -O opt-o file:打开输出文件(默认为标准输出)-O opt:打开特定监视选项有效的-O选项:if,vm,lv,pv,all if:监视逻辑文件I/O vm:监视虚拟内存I/O lv:监视逻辑卷I/O pv:监视物理卷I/O all:对if、vm、l

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论