-
Notifications
You must be signed in to change notification settings - Fork 5.1k
admin: add tcmalloc stats endpoint #41376
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
base: main
Are you sure you want to change the base?
Conversation
Hi @nezdolik while troubleshooting some overload manager issues, I noticed cases where this could help users avoid unnecessary recompilation. What are your thoughts? |
This change adds endpoint to retrieve TCMalloc stats. For details, see https://google.github.io/tcmalloc/stats.html Signed-off-by: Tero Saarni <tero.saarni@est.tech>
6d9a983
to
0f42a06
Compare
The asan, msan and tsan tests are failing
I guess tcmalloc is not really used in these builds and maybe that is why it returns empty string. I can disable this test for sanitizer builds. For reference, |
LGTM and I think this is very useful. Can you put |
Signed-off-by: Tero Saarni <tero.saarni@gmail.com>
Signed-off-by: Tero Saarni <tero.saarni@gmail.com>
+1 This is super useful. Thank you so much @tsaarni for adding this |
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.
I like this!
/wait
source/common/memory/stats.cc
Outdated
buffer.resize(strlen(buffer.c_str())); | ||
return buffer; | ||
#else | ||
return ""; |
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.
In this case, I think the admin endpoint should return 501 (Not implemented) and some text saying envoy wasn't built with tcmalloc.
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.
Done!
Signed-off-by: Tero Saarni <tero.saarni@gmail.com>
@tsaarni coverage degradation in source/common/memory looks real. https://storage.googleapis.com/envoy-cncf-pr/7f9d628/coverage/source/common/memory/index.html Can you see if the test coverage can be improved so CI can pass, please? /wait |
Signed-off-by: Tero Saarni <tero.saarni@gmail.com>
Commit Message: This change adds endpoint to retrieve TCMalloc stats. For details, see https://google.github.io/tcmalloc/stats.html.
Additional Description:
TCMalloc provides detailed statistics that can be useful for troubleshooting memory-related issues. For example, in several github issues about overload manager, users have been advised to patch Envoy in order to access these statistics to exclude possible heap fragmentation.
This pull request proposes adding a new admin interface endpoint
/memory/tcmalloc
that exposes the raw TCMalloc statistics, as generated by the TCMalloc implementation(s).See attached examples.
google-tcmalloc-dump.txt
gperftools-tcmalloc-dump.txt
These dumps do not contain any sensitive information.
Risk Level: low
Testing: A new test case
Docs Changes: Endpoint added in Administration interface document.
Release Notes: Added
/memory/tcmalloc
admin endpoint that provides TCMalloc memory statistics.Fixes #41375