zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.41k stars 3.97k forks source link

What is the relation between CpuThreshold option and request/limit cpu resource k8s deployment config? #4265

Open SgtDaJim opened 4 months ago

SgtDaJim commented 4 months ago

I am using go-zero in a service deployed on k8s, and I set request / limit cpu 4 cores (4000m). I found that the range of CpuThreshold is [0:1000), so I set 950. Under this config, I found my service cannot occupy all the cpu I request, and the rpc service will response service overloaded when cpu usage is near 1000m。 What can I do to make my service occupy all the resource I request?

kevwan commented 4 months ago

950 means 95% of your cpu limit. And 95% is a moving average value, you can consider it as the average value of last 5 seconds.

SgtDaJim commented 4 months ago

950 means 95% of your cpu limit. And 95% is a moving average value, you can consider it as the average value of last 5 seconds.

that is strange. I review my config, I set resource like this:

image

then i got an error before (time is UTC):

image

but at that time, cpu monitoring looked like this:

image

it seems not touching the threshold.

SgtDaJim commented 3 months ago

Hi, any update?