Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Enable heap prof of stmgr in heron-shell. #2005

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

objmagic
Copy link
Contributor

@objmagic objmagic commented Jun 27, 2017

Tested locally by curl heron-shell.

Normally stmgr uses <500MB, but in one of our prod topologies, some stmgrs are using >1.5GB memory which causes container gets killed. We suspect mempool is not capped but we'd like to do some heap profiling first.

@objmagic objmagic requested review from srkukarni, nlu90 and huijunw June 27, 2017 18:17
@objmagic objmagic added the stmgr label Jun 27, 2017
@srkukarni
Copy link
Contributor

What are the performance implications of doing this? Do we want to do this only when DEBUG is set?

@nlu90
Copy link
Member

nlu90 commented Jun 27, 2017

Before we merge this pr into master, let's test with some user topologies to see if there's any performance degradation.

For debugging the issue, we can make a customized release based on the branch.

@maosongfu
Copy link
Contributor

maosongfu commented Jun 27, 2017

Can we come up with a plan to carefully evaluate the performance implications of this? Stmgr is very performance-critical.

@@ -55,6 +56,8 @@ int main(int argc, char* argv[]) {
sp_int32 shell_port = atoi(argv[11]);
sp_string heron_internals_config_filename = argv[12];

HeapProfilerStart("stmgr");
Copy link
Contributor

@huijunw huijunw Jun 28, 2017

Choose a reason for hiding this comment

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

The profiling is enabled during the whole stmgr life time.

What about adding two handlers to the stmgr server to control the profiling start & end:

  1. HandleStartHeapProfilingMessage: HeapProfilerStart()
  2. HandleStopHeapProfilingMessage: HeapProfilerStop()

In this way, the profiling is not enabled by default and there is no impact on performance.

@objmagic
Copy link
Contributor Author

I searched around the web but found no official comment on overhead. Several blog posts say enabling heap profiling introduces little overhead. I have also tested on @ttim's large devel topology and I see no performance degradation.

This PR simply adds shell support. For tracker and UI support, we can do in another patch.

@objmagic
Copy link
Contributor Author

Any comment on this?

@srkukarni
Copy link
Contributor

@objmagic One easy check that you can do is run the exclamation topology both with and without this change and see what kind of impact you see.

@objmagic
Copy link
Contributor Author

@srkukarni Agree. I am on PTO and will find time to do so. Also, exclamation topology is throttled now so I will try word count one instead.

@huijunw
Copy link
Contributor

huijunw commented Oct 18, 2017

Any updates on this PR ? We saw stmgr out of memory on 0.15.1 version again. If the stmgr memory profiling is enabled, it should be easier to debug stmgr out of memory issue.

What about adding two handlers to the stmgr server to control the profiling start & end:
HandleStartHeapProfilingMessage: HeapProfilerStart()
HandleStopHeapProfilingMessage: HeapProfilerStop()
In this way, the profiling is not enabled by default and there is no impact on performance.

Besides, this profiling tool cannot tell which stmgr part code calls new_string(), new_string() occupied more than 60% of total stmgr memory if I remember correctly. @objmagic @srkukarni thoughts?

Copy link
Contributor

@srkukarni srkukarni left a comment

Choose a reason for hiding this comment

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

One issue with this change was that the profile was enabled all the time. Has that been fixed?

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.

5 participants