feat(resource): report node utilization on the resource endpoint - #50
Open
WenYuLuo wants to merge 1 commit into
Open
feat(resource): report node utilization on the resource endpoint#50WenYuLuo wants to merge 1 commit into
WenYuLuo wants to merge 1 commit into
Conversation
Expose cached CPU, memory, task, FD, and filestore occupancy ratios for advisory scheduling protection. Reuse the resource refresh loop and preserve existing capacity and storage overcommit semantics. Refs: inclusionAI#49 Signed-off-by: robbluo <luo1442@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A node can still advertise scheduler capacity while its actual resource usage is close to exhaustion. This implements RFC #49 by adding cached
utilization.cpu,memory,pid,fd, anddiskfractions to the existing Unix HTTP/resourceresponse.The existing five-second loop collects host and visible cgroup observations, preserves valid zero values, and reports unavailable metrics as
null. Disk occupancy comes from the same FilestoreDir filesystem snapshot asstorage, before overcommit. Existing capacity fields and capability markers remain compatible.The documentation defines data sources and coverage. FunctionSystem scheduling thresholds, specific pressure states, and isolation/recovery remain a separate consumer change.
Validation
Tested with Go 1.25.5 in Linux/arm64 containers:
make check-fmt— passed.make vet— passed.go test -p 4 -race ./pkg/resourcemanager ./pkg/volumemanager— passed.TestModuleLiveUtilizationOverUnixSocket— passed with real procfs/cgroup discovery, real filestore statistics, the periodic loop, and HTTP over a Unix socket. The independent scheduler-capacity provider is stubbed in this test.GitHub CI subsequently passed Unit tests, Go vet, Storage integration, Generated protobuf bindings, and Generated BPF objects at commit
38d41ca2b3cbdaaeed11f9ffc441fe3fa4cbb56a.make testwas run but is not green in this local environment. Unmodifiedmainata8c6ab83b064729f7f1b23079daf002fefe1c88dreproduces the same failures inTestIsMountpoint,TestCalcluteCacheSize, andTestPrepareKataDirectoryRootfsSeedsMountTargets; the baseline also exhibitedTestInterfaceShrinkRollbackOnFailure. A privileged retry withTESTFLAGS='-gcflags=all=-l -p 4'passes Kata, while the existing gomonkey-based utility/network tests still fail on this runner, including a fault ininternal/util. These tests and their implementations are unchanged by this PR.Refs #49.