quartermaine / k8_resource_allocation

BSD 2-Clause "Simplified" License
0 stars 0 forks source link

struct NodeUtilization #3

Open JamesBremner opened 2 weeks ago

JamesBremner commented 2 weeks ago
struct NodeUtilization {
    std::string node;
    int total_cpu_used;
    int total_ram_used;
    int node_cpu;  // Initial node CPU capacity
    int node_ram;  // Initial node RAM capacity
    float cpu_utilization;
    float ram_utilization;
};

Why is this structure needed? It is mostly a repetition of the data already stored in cThing.

It is a big source of bugs storing the same data in two different places. When synchronization fails the resulting bugs are really hard to find.

I would suggest adding the utilization attributes to cThing.

JamesBremner commented 2 weeks ago

I have added the table of node utilization to my code

Commit https://github.com/JamesBremner/so79049807/commit/7f7b5334f48debde6d52c1b6e148fc93b7f1067d

Total CPU and RAM % utilization for each node:
      Node Total_CPU_Used Total_RAM_Used  Node_CPU  Node_RAM CPU_Utilization RAM_Utilization
    node_1             28             22       256       512              10               4
    node_2            128            138       128       512             100              26
    node_3             32             64        32        64             100             100
    node_4             14             64        32        64              43             100

Notice that this was done without adding a structure or duplicating data.