I have read a little about how the cache of resources is working
it seems it caches only for 10 seconds, but for me it seems to cache forever. I ran this stress test on a Rocky machine for more than 10 seconds:
stress --cpu 4 --vm 2 --vm-bytes 1G --timeout 60s
stress: info: [2665] dispatching hogs: 4 cpu, 0 io, 2 vm, 0 hdd
stress: info: [2665] successful run completed in 60s
But the Incus API resources load data is always the same. In the code it seems to call /proc/loadavg, which is correct when I run the load test, but the Incus API data is always the same. There is something wrong somewhere, and this is the data I collected on the Incus server:
[root@localhost ~]# cat /proc/loadavg
0.04 0.10 0.17 1/236 2647
[root@localhost ~]# cat /proc/loadavg
0.03 0.10 0.17 1/236 2648
[root@localhost ~]# cat /proc/loadavg
0.03 0.10 0.17 1/236 2649
[root@localhost ~]# cat /proc/loadavg
0.03 0.10 0.17 1/236 2650
[root@localhost ~]# incus query /1.0/resources | jq '{load, memory}'
{
"load": {
"Average10Min": 0.1,
"Average1Min": 0.12,
"Average5Min": 0.13,
"Processes": 195
},
"memory": {
"hugepages_size": 2097152,
"hugepages_total": 0,
"hugepages_used": 0,
"nodes": [
{
"hugepages_total": 0,
"hugepages_used": 0,
"numa_node": 0,
"total": 4831838208,
"used": 798724096
}
],
"total": 4831838208,
"used": 1054576640
}
}
[root@localhost ~]# incus query /1.0/resources | jq '{load, memory}'
{
"load": {
"Average10Min": 0.1,
"Average1Min": 0.12,
"Average5Min": 0.13,
"Processes": 195
},
"memory": {
"hugepages_size": 2097152,
"hugepages_total": 0,
"hugepages_used": 0,
"nodes": [
{
"hugepages_total": 0,
"hugepages_used": 0,
"numa_node": 0,
"total": 4831838208,
"used": 798724096
}
],
"total": 4831838208,
"used": 1054576640
}
}
[root@localhost ~]# incus query /1.0/resources | jq '{load, memory}'
{
"load": {
"Average10Min": 0.1,
"Average1Min": 0.12,
"Average5Min": 0.13,
"Processes": 195
},
"memory": {
"hugepages_size": 2097152,
"hugepages_total": 0,
"hugepages_used": 0,
"nodes": [
{
"hugepages_total": 0,
"hugepages_used": 0,
"numa_node": 0,
"total": 4831838208,
"used": 798724096
}
],
"total": 4831838208,
"used": 1054576640
}
}
[root@localhost ~]# cat /proc/loadavg
1.00 0.30 0.23 7/243 2679
[root@localhost ~]# cat /proc/loadavg
1.00 0.30 0.23 7/243 2680
[root@localhost ~]# cat /proc/loadavg
1.40 0.39 0.27 7/243 2681
[root@localhost ~]# cat /proc/loadavg
1.40 0.39 0.27 7/243 2682
[root@localhost ~]# cat /proc/loadavg
1.77 0.49 0.30 7/243 2685
[root@localhost ~]# incus query /1.0/resources | jq '{load, memory}'
{
"load": {
"Average10Min": 0.1,
"Average1Min": 0.12,
"Average5Min": 0.13,
"Processes": 195
},
"memory": {
"hugepages_size": 2097152,
"hugepages_total": 0,
"hugepages_used": 0,
"nodes": [
{
"hugepages_total": 0,
"hugepages_used": 0,
"numa_node": 0,
"total": 4831838208,
"used": 798724096
}
],
"total": 4831838208,
"used": 1054576640
}
}
[root@localhost ~]# incus query /1.0/resources | jq '{load, memory}'
{
"load": {
"Average10Min": 0.1,
"Average1Min": 0.12,
"Average5Min": 0.13,
"Processes": 195
},
"memory": {
"hugepages_size": 2097152,
"hugepages_total": 0,
"hugepages_used": 0,
"nodes": [
{
"hugepages_total": 0,
"hugepages_used": 0,
"numa_node": 0,
"total": 4831838208,
"used": 798724096
}
],
"total": 4831838208,
"used": 1054576640
}
}
[root@localhost ~]# incus query /1.0/resources | jq '{load, memory}'
{
"load": {
"Average10Min": 0.1,
"Average1Min": 0.12,
"Average5Min": 0.13,
"Processes": 195
},
"memory": {
"hugepages_size": 2097152,
"hugepages_total": 0,
"hugepages_used": 0,
"nodes": [
{
"hugepages_total": 0,
"hugepages_used": 0,
"numa_node": 0,
"total": 4831838208,
"used": 798724096
}
],
"total": 4831838208,
"used": 1054576640
}
}
[root@localhost ~]#