You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/example/load/simulate/cpu/cpu-accuracy.md

28 lines
786 B
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 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`使用率,两者进行对比,即可知道是否准确