性能测试分析之CPU篇_第1页
性能测试分析之CPU篇_第2页
性能测试分析之CPU篇_第3页
性能测试分析之CPU篇_第4页
性能测试分析之CPU篇_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

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

文档简介

1、性能测试分析之cpu篇目录u linux系统结构简介u 用户态cpu消耗分析u 内核态cpu消耗分析u 硬中断&软中断u load average剖析linux系统结构linux系统结构几种cpu消耗us%user cpu time (or) % cpu time spent in user spacesy%system cpu time (or) % cpu time spent in kernel spaceni%user nice cpu time (or) % cpu time spent on low priority processesid%idle cpu time (or) %

2、 cpu time spent idlewa%io wait cpu time (or) % cpu time spent in wait (on disk)hi%hardware irq (or) % cpu time spent servicing/handling hardware interruptssi%software irq (or) % cpu time spent servicing/handling software interruptsst%steal time - - % cpu time in involuntary wait by virtual cpu while

3、 hypervisor is servicing another processor (or) % cpu time stolen from a virtual machinecpu调度用户态cpu例1:程序cpu usr%瓶颈问题定位。模拟程序testmap主线程:死循环阻塞线程1: sleep线程2 : 循环map find操作执行命令:top h p 7152用户态cpu执行命令:pstack 7152分析过程:通过top h p xx 发现线程7153占用cpu特别高1. 通过pstack 发现线程7153在做map查询操作,大量的红黑树查找操作。用户态cpu例2:程序cpu usr%

4、瓶颈问题定位。(如果线程cpu消耗比较均衡)执行:perf top -p 7152 -e cycles:u参考案例:vtdu因cpu消耗过高回滚内核态cpu例3:定位sy%消耗过高问题执行:perf top -p xxxx -e cycles:k内核态cpu上下文切换(只会发生在内核态)当前执行任务时间片用完,cpu正常调度下一个任务。i/o阻塞抢占锁资源,用户代码挂起(sleep),等待条件变量1. 硬中断&软中断例4:程序问题造成大量的上下文切换执行:testcsw程序开启100个线程,每个线程usleep(1*1000)硬中断&软中断网卡中断为例:频繁的数据包收发会耗尽cpu时间多核cp

5、u,如何做中断负载均衡?多队列网卡: 只需配置每个队列的cpu亲和性,smp_affinity。单队列网卡: 先通过rps模拟出多队列再最cpu亲和性。rps:根据数据包源地址、目的地址和源端口做hash,来选择不同cpu。rfs: rps负载均衡的优化。load average剖析load averagesystem load averages is the average number of processes that are either in a runablerunable or uninterruptableuninterruptable state. a process in

6、a runnable state is either using the cpu or waiting to use the cpu. a process inuninterruptable state is waiting for some i/o access,egwaiting for disk. the averages are taken over the three time intervals. load averages are not normalized for the number of cpus in a system, so a loadaverage of 1 means a single cpu system is loaded all the time while on a 4 cpu system it means it was idle 75% of the time.进程状态load average剖析例5:task_uninterruptible状态进程过

温馨提示

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

最新文档

评论

0/150

提交评论