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

More getHeapStatistics stats #2079

Closed
yepitschunked opened this issue Jun 29, 2015 · 7 comments
Closed

More getHeapStatistics stats #2079

yepitschunked opened this issue Jun 29, 2015 · 7 comments
Labels
feature request Issues that request new features to be added to Node.js. v8 engine Issues and PRs related to the V8 dependency.

Comments

@yepitschunked
Copy link

Coming from running JVM services, it'd be great to have a more detailed view into old-space/new-space usage over time, time spent in GC, etc.

I noticed these are being tracked/printed out by v8 when --trace_gc is on (https://github.com/v8/v8-git-mirror/blob/master/src/heap/gc-tracer.cc) but there's no visibility into this from user code. Is there some way to get at this information?

@ofrobots
Copy link
Contributor

Can you elaborate on what you mean by 'visibility .. from user code'? What would you like to see that is not available today when you pass the --trace_gc option to node.js?

@brendanashworth brendanashworth added v8 engine Issues and PRs related to the V8 dependency. feature request Issues that request new features to be added to Node.js. labels Jun 29, 2015
@yepitschunked
Copy link
Author

You're right, trace_gc gives us all the stats we want. However, this gets printed out to stdout/(err?) directly by v8. It would be nice to be able to query them from Javascript as well, so we don't have to write a separate trace_gc-output-parser. We're already tracking a variety of counters and other stats in our main app process, and it'd be convenient to include VM stats like these in there as well.

@bnoordhuis
Copy link
Member

Per-space statistics are not currently exposed through V8's C++ API (and therefore not through the v8 module's API.) Someone - you? - would first have to take it up with V8, either through a feature request or a CL.

Tracking GC time is possible with the GC prologue and epilog callbacks. v0.11 exposed that functionality to JS land for a while but I removed it again in dab6f68 for reasons outlined in the commit log.

@bripkens
Copy link
Contributor

@bnoordhuis: We are currently looking into the same feature for a monitoring product. As far as I understand, v8 now has support for space analysis via GetHeapSpaceStatistics. Would you be willing to accept a feature which adds support for heap space analysis?

I am thinking about the following: Expose a function as part of the v8 module called getHeapSpaceStatistics() which returns the statistics for all spaces. So basically iterating through all spaces, aggregating the results and returning them.

If such an interest exists, I'd willing to try to contribute this.

@bripkens
Copy link
Contributor

The v8 sources confirm that heap statistics include new_space, old_space, map_space, code_space, and large_object_space.

@bnoordhuis
Copy link
Member

@bripkens v8.getHeapSpaceStatistics() sounds like a reasonable addition to me.

@bripkens
Copy link
Contributor

great, I'll get right to it then :)

bripkens added a commit to bripkens/node that referenced this issue Jan 17, 2016
Provide means to inspect information about the separate heap spaces via
a callable API. This is helpful to analyze memory issues.

Fixes nodejs#2079
evanlucas pushed a commit that referenced this issue Jan 18, 2016
Provide means to inspect information about the separate heap spaces
via a callable API. This is helpful to analyze memory issues.

Fixes: #2079
PR-URL: #4463
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
scovetta pushed a commit to scovetta/node that referenced this issue Apr 2, 2016
Provide means to inspect information about the separate heap spaces
via a callable API. This is helpful to analyze memory issues.

Fixes: nodejs#2079
PR-URL: nodejs#4463
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jan 13, 2017
Provide means to inspect information about the separate heap spaces
via a callable API. This is helpful to analyze memory issues.

Fixes: #2079
PR-URL: #4463
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jan 24, 2017
Provide means to inspect information about the separate heap spaces
via a callable API. This is helpful to analyze memory issues.

Fixes: #2079
PR-URL: #4463
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Feb 1, 2017
Provide means to inspect information about the separate heap spaces
via a callable API. This is helpful to analyze memory issues.

Fixes: #2079
PR-URL: #4463
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants