Skip to content

Feature: Add Threshold to avoid overloading a node (Memory) #373

@Chipmonk2

Description

@Chipmonk2

General

Having a heterogeneous setup can lead to overloading a node even if over provisioning is turned off. In my case I have 2 nodes with 16GB RAM each and one with 384GB. Running proxlb often resulted in the 2 small nodes getting VMs assigned up to 98% memory usage which doesn't leave much headroom for proxmox itself.
Introducing a (configurable) threshold would solve this.

Details

I added s a bit of code into nodes.py to subtract a static amount of memory from the evaluation of each active node. This was then taken as the "real" amount of total memory the node has, essentially reserving the configured amount of memory for proxmox and leaving a bit of headroom.
I'm not a developer and I'm pretty sure there is a more elegant way to do this but it proves the idea as working.
If its not a good idea to add it into the project at least it might help someone with the same issue.

My addition looks like this:

             nodes["nodes"][node["node"]]["cpu_used_percent"] = nodes["nodes"][node["node"]]["cpu_used"] / node["maxcpu"] * 100
                # chipmunk: define a hard limit to avoid overfilling a node by subtracting some memory from the evaluated value
                # this ensures some room for proxmox itself
                RESERVE_GB = 4  # for example, reserve 4 GB
                RESERVE_BYTES = RESERVE_GB * 1024**3
                # nodes["nodes"][node["node"]]["memory_total"] = node["maxmem"]
                nodes["nodes"][node["node"]]["memory_total"] = node["maxmem"] - RESERVE_BYTES

regards,
Chip

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions