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

NAS-133069 / 25.04 / Call get_memory_info() everywhere #15200

Merged
merged 9 commits into from
Dec 13, 2024
Merged

Conversation

yocalebo
Copy link
Contributor

Similar to recent changes, there is no reason to use psutil to return basic memory information. Especially since we're only using 2 lines from /proc/meminfo output. Instead add a get_memory_info() helper function and call it everywhere.

I also converted this from a dataclass to a TypedDict because the data classes.asdict function is notoriously slow (makes deepcopy's) and so while we saved memory by using a frozen dataclass we lost all efficiency by calling asdict in the truenas_meminfo netdata chart.

@yocalebo yocalebo requested a review from a team December 13, 2024 14:32
@bugclerk
Copy link
Contributor

@bugclerk bugclerk changed the title Call get_memory_info() everywhere NAS-133069 / 25.04 / Call get_memory_info() everywhere Dec 13, 2024
@truenas truenas deleted a comment from bugclerk Dec 13, 2024
@yocalebo yocalebo merged commit 2c636bc into master Dec 13, 2024
2 checks passed
@yocalebo yocalebo deleted the fix-mem-info branch December 13, 2024 15:03
@bugclerk
Copy link
Contributor

This PR has been merged and conversations have been locked.
If you would like to discuss more about this issue please use our forums or raise a Jira ticket.

@truenas truenas locked as resolved and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants