now I want to give some limited resources (CPU) for the service, just not allowing using all the resources on the system, I'm using KinD on my local but It's not working at all for me.
I'm using linux as well,
and the configuration that I'm using:
apiVersion: apps/v1
kind: Deployment
metadata:
name: name-pod
namespace: name-system
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: name
template:
metadata:
labels:
app: name
spec:
containers:
- name: name-api
resources:
limits:
cpu: "2000m"
requests:
cpu: "1000m"
the result of my program still using 8 threads, but It should be 2 instead of 8.
2021/12/31 06:08:18 starting service CPU[8]
the example of code:
I'm using automaxprocs library:
if _, err := maxprocs.Set(); err != nil {
fmt.Println("maxprocs: %w", err)
os.Exit(1)
}
g := runtime.GOMAXPROCS(0)
log.Printf("starting service CPU[%d] \n", g)
Could you help me? what's wrong with my process?
No that's cpu time limit not #cores. I think you gotta go through admission controller. Let me see, got interested in this
Обсуждают сегодня