Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory stats for cgroup-v2 #10286

Merged
merged 4 commits into from
Apr 2, 2021
Merged

Memory stats for cgroup-v2 #10286

merged 4 commits into from
Apr 2, 2021

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented Apr 1, 2021

When running with cgroup-v2, the measured memory stats are Usage, Cache, and Swap only: https://github.com/opencontainers/runc/blob/v1.0.0-rc93/libcontainer/cgroups/fs2/memory.go#L75-L106 .

Also, in RSS isn't measured in a task, then nomad alloc status will use the reported Usage for the top level item. This PR only changes the CLI, and we need to update the UI as well.

Fixes #10190
Related to #10251

Mahmood Ali added 2 commits April 1, 2021 12:13
If the host is running with cgroup-v2, RSS and Max Usage doesn't get
reported anymore.
If the docker engine is running on cgroup-v2 host, then RSS and Max
Usage doesn't get reported.

Using a heauristic here to avoid adding more API calls to the Docker
Engine to infer cgroups version. Also, opted to avoid coordinating stats
collection with fingerprinting, which adds concurrency complexities.
If a task doesn't report RSS, let's use memory usage.
command/helpers.go Outdated Show resolved Hide resolved
drivers/docker/util/stats_posix.go Outdated Show resolved Hide resolved

// cgroup-v2 only exposes a subset of memory stats
DockerCgroupV1MeasuredMemStats = []string{"RSS", "Cache", "Swap", "Usage", "Max Usage"}
DockerCgroupV2MeasuredMemStats = []string{"Cache", "Swap", "Usage"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #9073 we have an issue where metrics that aren't being measured are still being emitted to the metrics endpoint. Does this help with that situation here or will this still result in empty metrics being emitted? See task_runner.go#L1309-L1336.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't address that issue. We can update task_runners.go to see if the metrics are measured.

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@notnoop notnoop merged commit 33628b5 into main Apr 2, 2021
@notnoop notnoop deleted the b-executor-stats branch April 2, 2021 16:27
schmichael pushed a commit that referenced this pull request May 14, 2021
@tgross tgross added this to the 1.1.0 milestone May 17, 2021
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fedora 33 exec and java memory usage of allocation is always 0 bytes
2 participants