zoukankan      html  css  js  c++  java
  • top中的wa的理解

    CPU使用率:
    参考 mpstat 手册,%usr + %nice + %sys + %iwoait + %irq + %soft + %steal + %guest + %gnice + %idle = 100%

    %steal一般是在虚拟机中才能看到数值,比如CPU overcommitment很严重的VPS,而%guest和%nice一般都很低,
    所以也可以根据/proc/stat或者top可得,user + nice + system + idle + iowait + irq + softirq + steal = 100

    To calculate Linux CPU usage time subtract the idle CPU time from the total CPU time as follows:
    Total CPU time since boot = user + nice + system + idle + iowait + irq + softirq + steal
    Total CPU Idle time since boot = idle + iowait
    Total CPU usage time since boot = (Total CPU time since boot) - (Total CPU Idle time since boot)
    Total CPU percentage = (Total CPU usage time since boot)/(Total CPU time since boot X 100)

    %iowait:
    %iowait 表示在一个采样周期内有百分之几的时间属于以下情况:CPU空闲、并且有仍未完成的I/O请求。 就是由于IO导致无法充分利用CPU的时间。
    %wa的解释:Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. 因此只要IO时间段内有CPU空闲,那这段CPU空闲的锅就会由IO来背。wa就是用来提示io可能阻塞了系统性能。 实际wa本来也就是一段CPU空闲时间。

    对 %iowait 常见的误解有两个:
      一是误以为 %iowait 表示CPU不能工作的时间,
      二是误以为 %iowait 表示I/O有瓶颈。

    首先 %iowait 升高并不能证明等待I/O的进程数量增多了,也不能证明等待I/O的总时间增加了。例如,在CPU繁忙期间发生的I/O,无论IO是多还是少,%iowait都不会变;当CPU繁忙程度下降时,有一部分IO落入CPU空闲时间段内,导致%iowait升高。

    可见%iowait是一个非常模糊的指标,如果看到 %iowait 升高,还需检查I/O量有没有明显增加,avserv/avwait/avque等指标有没有明显增大,应用有没有感觉变慢,如果都没有,就没什么好担心的。有可能只是CPU闲了,结果wa指标出来了。

    vmstat、sar、dstat、sysstat都没有对磁盘作非常详细的监控。
    怀疑IO真的到达瓶颈时可以通过iostat来确认当前磁盘的IO状态。iostat -d -x -k -c 1 10
    也可以通过dstat来查看各种负载状况来确认是否由其他负载导致。dstat -lmcdnr -fs --top-mem --top-io --top-cpu

  • 相关阅读:
    MySQL Create table as / Create table like
    Oracle CAST() 函数 数据类型的转换
    day 12
    day 11
    day 10
    day 9
    day 8
    day 7
    day 6
    day 5
  • 原文地址:https://www.cnblogs.com/dongzhiquan/p/top_wa_io.html
Copyright © 2011-2022 走看看