-
CPU、内存和IO关系USE模型
-
USE模型
-
吞吐率和延迟的特点
-
什么东西影响了吞吐率和延迟
-
各种各样的Linux剖析工具
-
火焰图
-
All-in-one和阅码场开源项目LEP(Linux Easy Profiling)
Linux 做性能优化是一个 full stack 的工作,需要你非常了解 CPU MEM IO ,因为你不知道系统的瓶颈在哪里,你都不知道内存和IO交换的复杂的细节,
不理解什么时候会引入延迟,CPU 和 cache 直接 什么时候命中,什么时候 不命中,不理解IO是怎么被CPU访问的一个全过程,你对linux本身不是很了解的话,
你是不太可能会对性能做一个优化。
1、CPU、内存和IO关系USE模型
再谈到性能分析的时候,经常会用到的一个模型就是 USE模型 :http://www.brendangregg.com/usemethod.html
The USE Method can be summarized as:
For every resource, check utilization, saturation, and errors.
It's intended to be used early in a performance investigation, to identify systemic bottlenecks.
Terminology definitions:
- resource: all physical server functional components (CPUs, disks, busses, ...) [1]
- utilization: the average time that the resource was busy servicing work [2]
- saturation: the degree to which the resource has extra work which it can't service, often queued
- errors: the count of error events
The metrics are usually expressed in the following terms:
- utilization: as a percent over a time interval. eg, "one disk is running at 90% utilization".
- saturation: as a queue length. eg, "the CPUs have an average run queue length of four".
- errors: scalar counts. eg, "this network interface has had fifty late collisions".
这里解释一下
utilization : 利用率
saturation:饱和度
本来这篇文章已经写完了,由于网络的原因,草稿丢失了,
以后再补回来吧
下面介绍一个开源分析的项目,非常推荐
可以在电路板上跑
https://github.com/linuxep/lepv
在PC Linux/WIN 下跑下面的
https://github.com/linuxep/lepd
之后你就可以实时看到你系统的CPU IO MEM perf 火焰图等性能指标。
宋宝华:LEP(Linux易用剖析器) 是什么,为什么以及怎么办(1)
下面是Linux 性能分析方面的最权威的专家了:
http://www.brendangregg.com/index.html
https://github.com/brendangregg