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

Tier settings not working #13

Open
gaam24 opened this issue Nov 16, 2024 · 9 comments
Open

Tier settings not working #13

gaam24 opened this issue Nov 16, 2024 · 9 comments

Comments

@gaam24
Copy link

gaam24 commented Nov 16, 2024

Describe the bug
Even though I use sample tier settings, all lxc containers are scaled to default settings. When debugging the settings for each container it came out that they were default (only added print in scaling_manager.py after config = DEFAULTS.get(f"TIER_{ctid}", DEFAULTS)).

To Reproduce
Steps to reproduce the behavior:

  1. Add Tier in '/etc/lxc_autoscale/lxc_autoscale.yaml'
  2. Reload service

Additional context
Python 3.11.2
Kernel Version: Linux 6.8.12-4-pve (2024-11-06T15:04Z)
Manager Version: pve-manager/8.2.8/a577cfa684c7476d

logs.txt
lxc_autoscale.txt

@fabriziosalmi
Copy link
Owner

THank you to point me out to that, I will try to fix latest 2 issues togheter in my next free time slot, if someone wanna contribute in the meanwhile it will be appreciated!

@fabriziosalmi
Copy link
Owner

Hopefully fixed with this commit

@pear235
Copy link

pear235 commented Jan 15, 2025

I don't think it's working, I set up a tier for a LXC to have at least 1024MB memory, but upon restarting the script it decreases to minimum set in the Default section - 512MB

The Tier section is after the Default one in the yaml config file

@fabriziosalmi fabriziosalmi reopened this Jan 15, 2025
@fabriziosalmi
Copy link
Owner

Thank you to note this, I will keep u posted here!

@pear235
Copy link

pear235 commented Jan 15, 2025

Thanks! I am also having issues with two other things:

  • CPU scale down to less cores than the "min_cores" value is set - this i was able to fix by modifying the following:
    if new_cores >= min_cores:
    into
    if new_cores > min_cores:
    in the scaling_manager.py

  • RAM size doesn't decrease, even if usage is at less that 1% - i tried playing with min_decrease_chunk and / or memory thresholds, but no luck unfortunately

@fabriziosalmi
Copy link
Owner

warm welcome :))

@gaam24
Copy link
Author

gaam24 commented Jan 16, 2025

I agree with pear, I tested this yesterday and have this same issues.

@fabriziosalmi
Copy link
Owner

fabriziosalmi commented Jan 16, 2025

Should be fixed by using this approach(a62c82a).

On my Proxmox node is working as expected also respect minimum ram settings.

@pear235
Copy link

pear235 commented Jan 18, 2025

I don't think this fixed it :|

Example:

lxc_autoscale.json
lxc_autoscale.log
lxc_autoscale.yaml.log

TIER_plex:
lxc_containers:
- 101

cpu_upper_threshold: 80
cpu_lower_threshold: 30
memory_upper_threshold: 80
memory_lower_threshold: 30
min_cores: 2
max_cores: 6
min_memory: 1024
core_min_increment: 1
core_max_increment: 1
memory_min_increment: 128
min_decrease_chunk: 128

  • After few executions - Started at 2GB RAM and 2 CPUs:

2025-01-18 07:51:32 - INFO - Container 101: CPU usage: 0.0%, Memory usage: 30.12MB (97.65% free of 1280MB total), Initial cores: 1, Initial memory: 1280MB

So the memory decrease appear to be working, however it ignores min_cores for the tier

===========================================================================

TIER_emby:
lxc_containers:
- 102
cpu_upper_threshold: 80
cpu_lower_threshold: 30
memory_upper_threshold: 80
memory_lower_threshold: 30
min_cores: 1
max_cores: 6
min_memory: 1024
core_min_increment: 1
core_max_increment: 1
memory_min_increment: 128
min_decrease_chunk: 128

  • After few executions - Started at 8GB RAM and 6 CPUs:

2025-01-18 07:51:32 - INFO - Container 102: CPU usage: 68.5%, Memory usage: 22.98MB (99.67% free of 6912MB total), Initial cores: 6, Initial memory: 6912MB

========================================================================

TIER_jellyfin:
lxc_containers:
- 115
cpu_upper_threshold: 80
cpu_lower_threshold: 40
memory_upper_threshold: 80
memory_lower_threshold: 30
min_cores: 1
max_cores: 6
min_memory: 1024
core_min_increment: 1
core_max_increment: 1
memory_min_increment: 128
min_decrease_chunk: 128

  • After few executions - Started at 4GB RAM and 6 CPUs:

2025-01-18 08:13:59 - INFO - Container 115: CPU usage: 40.0%, Memory usage: 52.88MB (98.71% free of 4096MB total), Initial cores: 5, Initial memory: 4096MB

So here it decreased CPU cores count, but didn't even touch the memory.

BTW, are the CPU stats in PVE console the same as those the scripts is seeing?

In shell i see that CPU usage for CT115 is less than 2% :
lxc/115 │ lxc │ 1.26% │ 28.61 GiB │ 122.69 GiB │ 278.57 GiB │ │ │ │ 5

Whereas in the scripts log file:

2025-01-18 08:23:00 - INFO - Container 115: CPU usage: 40.0%, Memory usage: 46.91MB (98.85% free of 4096MB total), Initial cores: 5, Initial memory: 4096MB

@fabriziosalmi fabriziosalmi reopened this Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants