How to read the output from `/1.0/resources`

Hi

So i’m trying to figure something out when calling the resources API. Mainly the memory metrics. It looks something like this.

"memory": {
    "hugepages_size": 2097152,
    "hugepages_total": 0,
    "hugepages_used": 0,
    "nodes": [
      {
        "hugepages_total": 0,
        "hugepages_used": 0,
        "numa_node": 0,
        "total": 4294967296,
        "used": 3809120256
      }
    ],
    "total": 4294967296,
    "used": 2107842560
  },

I noticed that the used attribute outside the nodes is lower, I believe that is the ‘actual’ memory usage.

I’m however trying to figure out what the used property in the nodes actually mean.

My intuition is telling me that that’s the actual available memory for the LXD node. Doing the math that’s about 88% of memory. Would my intuition be correct? If someone could help me decipher these numbers that would be really appreciated.

Hi Zach,

I’ve been poking around close to this for some spec work; the function that grabs that info is here. Looks like the difference between /sys/devices/system/memory and /sys/devices/system/node/memory.

[1] https://superuser.com/questions/1530629/memory-distribution-in-numa-nodes-does-not-add-up-to-system-memory