Number of Go-Routines in one POD

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.17
Cloud being used: GKE
Installation method: Auto
Host OS: CentOS
CNI and version:
CRI and version:

We are running one micro-service Container in one POD, Complete micro-service is written in Golang, In our Micro-services we are starting multiple Kafka Consumers/producers in the form of Go-Routines. Ideally how many Go-routines can be run Inside One Kubernetes POD?

Each POD is allowed to use not more than 2 CPUs.

That’s not an really answerable question. If most of your goroutines are blocking, you might run thousands of them. If most of them are compute-intensive, you might only run 2.

Thanks @thockin for Reply. Yes I was also hesitating to ask first. More I can share is Each go Routines is Either Kafka Consumer or Producer, Consumers Could be CPU intensive but Producers are lightweight.

I can’t see any limit imposed by the Pod. I would say as many as you could in a host with the same CPUs and memory

@feloy But as @thockin mentioned, If Go-routines are CPU intensive and There is no limit on CPU usage on POD, will one POD not block all resources and Other PODs will suffer?

Unless you define cpu limits for your container, it will get as cpu as available on the node. The host scheduler will make the job of distributing CPU cycles between your process full of go routines and other processes in other pods

@feloy OK, So the Host Scheduler is something Part of Kubernetes or Standard OS scheduler we are talking about here?

I’m talking about the standard os scheduler

1 Like