willwill
willwill

Reputation: 1056

What to put for Kubernetes resource requests/limits?

I've seen articles recommending that resource requests/limit should be implemented. However, none I've found that discuss on what numbers to fill in.

For example, consider a container use zero CPU while idle, 80% under normal user requests and 200% CPU when hit by some rare requests:

There are also cases like

Ideally vertical pod autoscaler would probably solve these problems automatically, but it is still in alpha today.

Upvotes: 0

Views: 381

Answers (1)

willwill
willwill

Reputation: 1056

What I've been doing is to use telegraf to collect resource usage, and use the 95th percentile while the limit is set to 1 CPU and twice the memory request.

Screenshot

The problem with this method is

  • App that utilize multicores during startup, then under a core throughout their life will take longer to starts. I've observed a 2 minutes Spring startup become 5 minutes
  • Apps that are rarely used will have less resource reserved, and so have to rely on bursting capacity when it get invoked. This could be a problem if it has a surge in popularity.

Upvotes: 1

Related Questions