-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: track the memory usage of runtime info #44048
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cc @XuHuaiyu @guo-shaoge |
util/execdetails/execdetails.go
Outdated
// detailsNeedP90StructSize indicates the size of DetailsNeedP90Size, used for memory tracking. | ||
const detailsNeedP90StructSize = int64(unsafe.Sizeof(DetailsNeedP90{})) | ||
|
||
// backoffEmptyMapSzie indicates the size of BackoffSleep and BackoffTimes when the map is empty. | ||
const backoffEmptyMapSize = 48 * 2 | ||
|
||
// AvgMemorySizeForDetailsNeedP90 is the avg size of DetailsNeedP90 need. | ||
const AvgMemorySizeForDetailsNeedP90 = detailsNeedP90StructSize + backoffEmptyMapSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// detailsNeedP90StructSize indicates the size of DetailsNeedP90Size, used for memory tracking. | |
const detailsNeedP90StructSize = int64(unsafe.Sizeof(DetailsNeedP90{})) | |
// backoffEmptyMapSzie indicates the size of BackoffSleep and BackoffTimes when the map is empty. | |
const backoffEmptyMapSize = 48 * 2 | |
// AvgMemorySizeForDetailsNeedP90 is the avg size of DetailsNeedP90 need. | |
const AvgMemorySizeForDetailsNeedP90 = detailsNeedP90StructSize + backoffEmptyMapSize | |
// AvgMemorySizeForDetailsNeedP90 is the estimated size of DetailsNeedP90 struct. | |
// "48" represents the base memory overhead of a Go map after initialization. Here, the memory overhead of the \`BackoffSleep\` and \`BackoffTimes\` member attributes is recorded. | |
const AvgMemorySizeForDetailsNeedP90 = int64(unsafe.Sizeof(DetailsNeedP90{})) + 48*2 |
Co-authored-by: HuaiyuXu <[email protected]>
/test unit-test |
b962874
to
274a5ab
Compare
@wshwsh12: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #44047
Problem Summary: Track the memory usage of Runtime info.
Fix the memory leak in Runtime info.
What is changed and how it works?
Check List
Tests
Test the case in issue
Grafana:
![image](https://private-user-images.githubusercontent.com/14054293/241121691-f6d1f666-dd8d-41d0-ba71-e175e23be18f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzAyMzAsIm5iZiI6MTczOTM2OTkzMCwicGF0aCI6Ii8xNDA1NDI5My8yNDExMjE2OTEtZjZkMWY2NjYtZGQ4ZC00MWQwLWJhNzEtZTE3NWUyM2JlMThmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDE0MTg1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkxMjQzMTljMTc3ODNhODA0MjIxNmI1YjhhM2NkYWY0NWI3ZjkxNjBhODA1NzhjZWVjNWNlNmJiMTQwYzA4YzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Z9xwB1NHgBTTLupJk8rbsvG8KAzHN_R0JFkVQY-hvH0)
(From left to right are this patch with 1GB mem quota, this patch without mem_quota, master in 1GB mem quota)
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.