go-zero/example/load/simulate/cpu/cpu-accuracy.md
Sergey Cheung 21e811887c
Markdown lint (#58)
* markdown linter

* format markdown docs

* format exiting markdown docs
2020-09-11 19:42:58 +08:00

28 lines
786 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# cpu监控准确度测试
1. 启动测试pod
`make deploy`
2. 通过`kubectl get po -n adhoc`确认`sheeding` pod已经成功运行通过如下命令进入pod
`kubectl exec -it -n adhoc shedding -- sh`
3. 启动负载
`/app # go-cpu-load -p 50 -c 1`
默认`go-cpu-load`是对每个core加上负载的所以测试里指定了`1000m`等同于1 core我们指定`-c 1`让测试更具有可读性
`-p`可以多换几个值测试
4. 验证测试准确性
`kubectl logs -f -n adhoc shedding`
可以看到日志中的`CPU`报告,`1000m`表示`100%`,如果看到`500m`则表示`50%`,每分钟输出一次
`watch -n 5 kubectl top pod -n adhoc`
可以看到`kubectl`报告的`CPU`使用率,两者进行对比,即可知道是否准确