系统管理 维护监控 简单生活
系统管理
linux性能相关指标[监控基础知识一]
十 15th
一、SWAP
这个指标直接反映了系统内存的问题,如果有很多的SWAP空间被使用,一般能说明你系统的内存不足
二、Cache
当系统内存比应用需要的内存多的时候,系统会把数据cache在内存中,减少费时的IO操作
三、Buffer
当应用程序在做写磁盘操作时,系统会把要写的数据buffer起来,等到一个触发点的时候,再把buffer中的数据刷新到磁盘,减少应用程序等待IO操作的时间.一般你在看一个运行长时间的系统时,会发现它的可用内存很少,但是Cache和Buffer很大,这是正常情况,系统会利用你的所有自由内存来cache数据,当它需要分配内存的时候,会把cache的数据放回到disk
四、Run Queue Statistics
在linux中,process有两种状态: runnable,blocked waiting for an event to complete
一个blocked状态的process可能在等待一个I/O操作获取的数据,或者是一个系统调用的结果,
如果一个process在runnable状态,这就意味着它将同其他runnable状态的process等待CPU时间,而不是立即获得CPU时间,一个runnable状态的process不需要消耗CPU时间,只有当Linux调度进程从runnable队列中选择哪个process下次执行.
当 process在runnable状态,当时等待CPU时间时,他们形成的等待队列称作Run Queue.
Run Queue越大,表示等待的队列越长.
性能工具通常显示runnable processes的数目和blocked processes的数目.
五、load average
系统的load是指running和runnable process的总和.
例如:如果有两个processes在running和有三个在等待运行(runnable),那么系统的load为五.
Load average是指在指定时间内load的平均值.一般load average显示的三个数字的时间分别为1分钟,五分钟和十五分钟.
六、Context Switches
大部分现在的CPU在同一时间只能运行一个process.虽然也有一些CPU,例如超线程技术的CPU,能实现同时运行超过一个process,linux把这种CPU看作多个单线程CPU.
linux内核不断的在不同process间切换,造成一个错觉,让人感觉一个单CPU同时处理多个任务.不同process之间的切换称作 Context Switch.切换Context会触发大量的信息移动,这是比较高的开销.
context switches的产生
首先,kernel调度触发context switches.为了保证每个process平等的共享CPU时间,kernel周期性中断running的process,如果合适,kernel调度器会开始一个其它的process,当前的process停止执行,每次的周期性中断或者定时中断都可能触发context switch.每秒定时中断的次数因不同架构和不同的kernel版本而不同.
获取每秒中断次数的一个简单办法是通过监控 /proc/interrupts文件
七、Interrupts
CPU接收硬件驱动发出的中断请求.
例如:如果一个磁盘控制器从磁盘上取得了一个数据块,kernel需要读取使用这个块,那么磁盘控制器就会触发一个中断.
kernel接收每个中断,一个中断如果被处理器运行,那么这个中断被注册,否则,这个中断被忽略.在系统中,中断处理器的优先级非常高,执行速度非常快.
有些中断处理并不需要很高的处理优先级,所以也有soft- interrupt handler.如果有很多的中断,kernel需要花费大量的时间去处理中断.可以检查/proc/interrupts能够知道中断发生在哪个CPU 上.
八、CPU Utilization
CPU有7个参数
1、idle, 表示CPU闲置并等待工作分配.
2、user,表示CPU在运行用户的进程
3、system,表示CPU在执行kernel工作
4、nice, 表示CPU花费在被nice改变过优先级的process上的时间
注意:被nice命令改变优先级的process仅指那些nice值为负的process.花费在被nice命令改变优先级的任务上的时间也将被计算在系统和用户时间内,因此整个时间加起来可能会超过百分之百
5、iowait,表示CPU等待IO操作完成的时间
6、irq,表示CPU开销在响应硬中断上的时间
7、softirq,表示CPU开销在响应软中断上的时间.
TCP/IP Network Performance - Benchmarks and Tools
九 27th
- 可用性(availability)
- 响应时间(response time)
- 网络利用率(network utilization)
- 网络吞吐量(network throughput)
- 网络带宽容量(network bandwidth capacity
这里特别推荐一个带宽测试工具 xjperf 和一个用测试网络丢包率,响应时间,路由稳定性,的工具MTR
以下内容参考这里
Netperf
An engineer at Hewlett-Packard developed Netperf to help the Unix network benchmarking community many years ago, and this benchmarking tool remains popular in Unix / Linux environments today.
NetSpec
NetSpec strives to implement more realistic network performance testing scenarios than the standard utilities by acocunting for variable traffic flows. NetSpec is an academic research project that includes source code.
Nettest
Nettest is a simple latency and bendwidth performance benchmark for point-to-point TCP connections on Solaris and Linux.
TTCP
The Test TCP (TTCP) Benchmarking Tool measures network performance at the TCP and UDP level. Originally developed for Unix, TTCP has also been ported to Windows and other operating systems.
DBS - Distributed Benchmark System
The Distributed Benchmark System (DBS) is a performance benchmark tool for TCP/IP networks that attempts to expand on the capability of other tools in this category. DBS supports retransmission control and congestion avoidance performance evaluation across multiple dynamic connections.
最新评论