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

Human readable memory for VPA #7094

Closed
aleangelin88 opened this issue Jul 27, 2024 · 15 comments
Closed

Human readable memory for VPA #7094

aleangelin88 opened this issue Jul 27, 2024 · 15 comments

Comments

@aleangelin88
Copy link

Hello,
I have 2 questions that I cannot find answers for online

question 1:
is it possible to have the indication of memory in a more human readable fashion? like in Kb, Mb, Gb, etc

NAMESPACE NAME MODE CPU MEM PROVIDED AGE
default analyzer-vpa Off 1038m 4992073454 True 72m
default input-manager-vpa Off 25m 262144k True 72m

question 2:
is the indication of the cpu and memory usage per pods or per deployment? if I activate the autoscaler, would it divide the request and limit per pods accordingly?

thank you in advance

@adrianmoisey
Copy link
Member

/area vertical-pod-autoscaler

@austinorth
Copy link

Would also love human-readable memory!

@adrianmoisey
Copy link
Member

/retitle Human readable memory for VPA

@k8s-ci-robot k8s-ci-robot changed the title Questions about VPA autoscaler Human readable memory for VPA Oct 16, 2024
@adrianmoisey
Copy link
Member

This has been merged to master, and should be available in the next VPA release.
/close

Thanks @omerap12 for doing this one!

@k8s-ci-robot
Copy link
Contributor

@adrianmoisey: Closing this issue.

In response to this:

This has been merged to master, and should be available in the next VPA release.
/close

Thanks @omerap12 for doing this one!

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@omerap12
Copy link
Member

This has been merged to master, and should be available in the next VPA release.

/close

Thanks @omerap12 for doing this one!

My pleasure 😀

@kyleli666
Copy link

Hi all, I tried with 1.3.0 image with "--humanize-memory=true" today, but found the MEM value now having more digits with the unit "milibyte". This value looks to align with the code design 272063528960/1000/1024/1024=259.46Mi, but seems more unreadable. Is there some configuration I missed?

$ k get verticalpodautoscalers.autoscaling.k8s.io -n logging fluent-bit-service
NAME                 MODE      CPU    MEM             PROVIDED   AGE
fluent-bit-service   Initial   126m   272063528960m   True       2d21h

@adrianmoisey
Copy link
Member

Hi all, I tried with 1.3.0 image with "--humanize-memory=true" today, but found the MEM value now having more digits with the unit "milibyte". This value looks to align with the code design 272063528960/1000/1024/1024=259.46Mi, but seems more unreadable. Is there some configuration I missed?

Can you give us some steps to reproduce this?
I tested it and I got the correct result:

$ k get vpa -w
NAME          MODE   CPU   MEM   PROVIDED   AGE
hamster-vpa   Auto                          8s
hamster-vpa   Auto   627m   250Mi   True       48s
hamster-vpa   Auto   627m   250Mi   True       108s

I then turned the setting off, and the recommendation reverted to the non-human-readable format:

$ k get vpa -w
NAME          MODE   CPU    MEM     PROVIDED   AGE
hamster-vpa   Auto   627m   250Mi   True       2m22s
hamster-vpa   Auto   627m   262144k   True       3m23s
hamster-vpa   Auto   627m   262144k   True       4m23s

@kyleli666
Copy link

Hi @adrianmoisey , my vpa is installed with

tag=1.3.0; helm upgrade -i -n kube-system vpa fairwinds-stable/vpa -f vpa-values.yaml --set recommender.image.tag=$tag,updater.image.tag=$tag,admissionController.image.tag=$tag
# vpa-values.yaml
recommender:
  # recommender.enabled -- If true, the vpa recommender component will be installed.
  enabled: true
  # recommender.extraArgs -- A set of key-value flags to be passed to the recommender
  extraArgs:
    v: "4"
    humanize-memory: true # starting from 1.3.0
    pod-recommendation-min-cpu-millicores: 10
    pod-recommendation-min-memory-mb: 50
    target-cpu-percentile: 0.50
    target-memory-percentile: 0.50
  replicaCount: 1

Without "humanize-memory: true", I get this result, seems already worse than yours :\

$ k get vpa -A -w
NAMESPACE     NAME                       MODE      CPU    MEM         PROVIDED   AGE
kube-system   vpa-admission-controller   Auto      11m    52428800    True       158d
kube-system   vpa-recommender            Auto      11m    63544758    True       158d
kube-system   vpa-updater                Auto      11m    78221997    True       158d
logging       fluent-bit-service         Initial   126m   225384266   True       3d2h
monitoring    grafana                    Auto      11m    93633096    True       146d

With "humanize-memory: true", I get a result where 50Mi looks good but the others not.

$ k get vpa -A -w
NAMESPACE     NAME                       MODE      CPU    MEM             PROVIDED   AGE
kube-system   vpa-admission-controller   Auto      11m    50Mi            True       158d
kube-system   vpa-recommender            Auto      11m    63543705600m    True       158d
kube-system   vpa-updater                Auto      11m    93637836800m    True       158d
logging       fluent-bit-service         Initial   126m   272063528960m   True       3d2h
monitoring    grafana                    Auto      11m    93637836800m    True       146d

Thanks for your help!

@omerap12
Copy link
Member

Hi @adrianmoisey , my vpa is installed with

tag=1.3.0; helm upgrade -i -n kube-system vpa fairwinds-stable/vpa -f vpa-values.yaml --set recommender.image.tag=$tag,updater.image.tag=$tag,admissionController.image.tag=$tag
# vpa-values.yaml
recommender:
  # recommender.enabled -- If true, the vpa recommender component will be installed.
  enabled: true
  # recommender.extraArgs -- A set of key-value flags to be passed to the recommender
  extraArgs:
    v: "4"
    humanize-memory: true # starting from 1.3.0
    pod-recommendation-min-cpu-millicores: 10
    pod-recommendation-min-memory-mb: 50
    target-cpu-percentile: 0.50
    target-memory-percentile: 0.50
  replicaCount: 1

Without "humanize-memory: true", I get this result, seems already worse than yours :\

$ k get vpa -A -w
NAMESPACE     NAME                       MODE      CPU    MEM         PROVIDED   AGE
kube-system   vpa-admission-controller   Auto      11m    52428800    True       158d
kube-system   vpa-recommender            Auto      11m    63544758    True       158d
kube-system   vpa-updater                Auto      11m    78221997    True       158d
logging       fluent-bit-service         Initial   126m   225384266   True       3d2h
monitoring    grafana                    Auto      11m    93633096    True       146d

With "humanize-memory: true", I get a result where 50Mi looks good but the others not.

$ k get vpa -A -w
NAMESPACE     NAME                       MODE      CPU    MEM             PROVIDED   AGE
kube-system   vpa-admission-controller   Auto      11m    50Mi            True       158d
kube-system   vpa-recommender            Auto      11m    63543705600m    True       158d
kube-system   vpa-updater                Auto      11m    93637836800m    True       158d
logging       fluent-bit-service         Initial   126m   272063528960m   True       3d2h
monitoring    grafana                    Auto      11m    93637836800m    True       146d

Thanks for your help!

Can you share the recommender logs? We print wether we convert the metrics or not

@adrianmoisey
Copy link
Member

Can you paste your VPA objects here too please? At least for the VPA components.

@adrianmoisey
Copy link
Member

Ah, I reproduced it by increasing memory usage:

$ k get vpa -w -A
NAMESPACE     NAME              MODE   CPU    MEM    PROVIDED   AGE
default       hamster-vpa       Auto   100m   50Mi   True       3m2s
kube-system   vpa-recommender   Auto   10m    50Mi   True       110s
default       hamster-vpa       Auto   100m   183049912320m   True       4m42s

I didn't get a log similar to:

I0126 08:28:31.646220       1 types.go:99] "Converting raw value to humanized value" rawValue=52428800 humanizedValue="50.00Mi"

@kyleli666
Copy link

@omerap12 my logs recommender.log

@adrianmoisey My VPA Objects for the VPA components.

---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: vpa-admission-controller
  namespace: kube-system
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: vpa-admission-controller
  updatePolicy:
    updateMode: Auto
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: vpa-recommender
  namespace: kube-system
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: vpa-recommender
  updatePolicy:
    updateMode: Auto
  resourcePolicy:
    containerPolicies:
      - containerName: '*'
        minAllowed:
          memory: 50Mi
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: vpa-updater
  namespace: kube-system
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: vpa-updater
  updatePolicy:
    updateMode: Auto

@adrianmoisey
Copy link
Member

@kyleli666 could you open a new bug issue for this? It's strange to keep discussion on a closed issue

@kyleli666
Copy link

@kyleli666 could you open a new bug issue for this? It's strange to keep discussion on a closed issue

Here it is #7770

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants