Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support resource request tuning for cost optimistation #6989

Open
alexec opened this issue Aug 13, 2021 · 9 comments
Open

Support resource request tuning for cost optimistation #6989

alexec opened this issue Aug 13, 2021 · 9 comments
Labels
component:ui User interfaces bugs and enhancements enhancement New feature or request

Comments

@alexec
Copy link
Contributor

alexec commented Aug 13, 2021

Summary

Enhance the node view with information highlighting pods that are using much more or less that they request.

Motivation

I want to cost optimise and quickly. Nothing I've yet used makes that possible. But Argo CD is well place to make this easy.

Proposal

image

  1. This view only appears to surface total requests. What about per-pod requests.
  2. Combine this with metrics server data to surface the actual usage.
  3. Highlight diffs.
@alexec alexec added the enhancement New feature or request label Aug 13, 2021
@rbreeze rbreeze added the component:ui User interfaces bugs and enhancements label Aug 13, 2021
@keithchong
Copy link
Contributor

keithchong commented Sep 27, 2021

Hi @AlexC, @rbreeze , @alexmt, could you please elaborate on points 2 and 3?

So for point 1, do you want to show the actual CPU/Mem usage in the tooltip of each pod, something like this, or something else?

Screen Shot 2021-09-27 at 9 17 36 AM

Looks like there might be server and app controller changes

@alexec
Copy link
Contributor Author

alexec commented Sep 27, 2021

If a pod is using less resources that it requests (in resource requests) then it is costing more than it needs to.

Metrics Server stores the resource usage of pods.

https://github.com/kubernetes-sigs/metrics-server#use-cases

You can then calculate "(requested resources - resource usage) / requested resources" which would tell you how much more a resource is costing to run than it needs to.

You can then adjust your resource requests to pack you pods more efficiently and save $£¥.

@keithchong
Copy link
Contributor

Yeah, it looks like in the app controller, we are totalling up the capacity and resource requests for the entire node. I think we need to keep track of the individual pod stats, right @rbreeze ?

@keithchong
Copy link
Contributor

keithchong commented Oct 28, 2021

This will be for point 1 in the enhancement description. Using the sync-waves example:

Here are the requests for the frontend pod:

FrontendPodRequests

Here is the memory request for the backend pod (No specific CPU request, probably should not show it):

BackendPodRequest

Here is the total memory request, which adds up:

TotalAppMemoryRequests

Here is the total CPU request:

TotalAppCPURequest

@keithchong
Copy link
Contributor

keithchong commented Nov 1, 2021

Updated with usage stats

Usage

@keithchong
Copy link
Contributor

keithchong commented Nov 1, 2021

Hi @alexec, @rbreeze, @alexmt, I'm making progress with this. What do you think about the above? What's left is the actual usage percentage (the API returns different units.)

@alexec
Copy link
Contributor Author

alexec commented Nov 1, 2021

Maybe take a look at Kubecost.

They surface these details, but as a user, I want to know where I can save the most money. I don't want to tweak a resource from 110m to 100m, but I would if it was from 1000m to 500m.

@keithchong
Copy link
Contributor

Hi Alex, perhaps integrating this with Kubecost could be a follow-on change? Here we have the individual pod stats.

Screen Shot 2021-11-05 at 8 57 37 PM

Screen Shot 2021-11-05 at 8 57 30 PM

@keithchong
Copy link
Contributor

keithchong commented Nov 18, 2021

Latest screenshots with PR, with memory units fixed:

sync-waves-backend-pod

microk8s kubectl top pod backend-j2qq6 --namespace=default
NAME            CPU(cores)   MEMORY(bytes)   
backend-j2qq6   0m           2Mi     

sync-waves-frontend-pod

microk8s kubectl top pod frontend-9t5tn --namespace=default
NAME             CPU(cores)   MEMORY(bytes)   
frontend-9t5tn   0m           2Mi        

sync-waves-memory-requests

sync-waves-cpu-requests

CPU usage > 0m example
CPUusageExample

When metrics is not enabled:

metrics-not-available

keithchong added a commit to keithchong/argo-cd that referenced this issue Dec 1, 2021
Signed-off-by: Keith Chong <kykchong@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:ui User interfaces bugs and enhancements enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants