'cf app'始终显示0.0%cpu - 该值是如何衡量的?


时间
2025-03-13 05:16:13 (6天前)
  1. 如何计算?这个值是由健康经理收集的吗?我可以吗


信任
</跨度>
这个价值?



</跨度>
Foundry在OpenStack集群上运行。

  1. 状态自cpu内存盘de

2 条回复
  1. 0# 没身份别烦我 | 2019-08-31 10-32



    我相信信息流是:



    cf CLI&lt; - &gt;云控制器&lt; - &gt; DEA&lt; - &gt; Warden&lt; - &gt; cgroup CPU Accounting



    看到:




    此处的统计信息显示了容器在最后一秒CPU(VM)中花费的时间进程百分比。如果您的应用程序要执行更多CPU密集型操作,您可能会看到此数字增加。例如,我推了一个小的hello-world Golang应用程序,它在后台运行一个紧密的循环,它计算一些随机浮点数的正弦值,然后

    cf app

    显示15.5%的CPU使用率:




    1. package main

    2. import (
      fmt
      net/http
      os
      math
      math/rand
      )

    3. func main() {
      go func() {
      for {
      println(math.Sin(rand.Float64()))
      }
      }()

    4. http.HandleFunc("/", hello)
    5. fmt.Println("listening...")
    6. err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
    7. if err != nil {
    8.     panic(err)
    9. }
    10. }

    11. func hello(res http.ResponseWriter, req *http.Request) {
      fmt.Fprintln(res, go, world”)
      }

    12. </code>






登录 后才能参与评论