Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat: another way to get heap profile #426

Open
vagetablechicken opened this issue Mar 24, 2020 · 0 comments
Open

feat: another way to get heap profile #426

vagetablechicken opened this issue Mar 24, 2020 · 0 comments
Labels
type/enhancement Indicates new feature requests

Comments

@vagetablechicken
Copy link
Member

static bool get_heap_profile(std::string &result)
{
if (!is_heap_profile_enabled()) {
result = "no TCMALLOC_SAMPLE_PARAMETER in env";
return false;
}
MallocExtension::instance()->GetHeapSample(&result);
return true;
}

We use GetHeapSample() which means we must run servers with sampling turned on(set TCMALLOC_SAMPLE_PARAMETER). If we want to get heap profile, we must restart the server. It's completely unnecessary.

https://gperftools.github.io/gperftools/pprof_remote_servers.html says,
The other way is to call HeapProfileStart(filename) (from heap-profiler.h), continue to do work, and then, some number of seconds later, call GetHeapProfile() (followed by HeapProfilerStop()). The server can send the output of GetHeapProfile back as the HTTP response to pprof. (Note you must free() this data after using it.) This is similar to how profile requests are handled, below. This technique does not require the application to run with sampling turned on.

We can consult the implement in Doris for more details.

@hycdong @levy5307

@neverchanje neverchanje changed the title There's another way to get heap profile featThere's another way to get heap profile Mar 26, 2020
@neverchanje neverchanje changed the title featThere's another way to get heap profile feat: another way to get heap profile Mar 26, 2020
@neverchanje neverchanje added the type/enhancement Indicates new feature requests label Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

2 participants