Skip to content

More getHeapStatistics stats #2079

Description

@yepitschunked

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?

Activity

  1. ofrobots commented on Jun 29, 2015

    @ofrobots
    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?

  2. yepitschunked commented on Jun 30, 2015

    @yepitschunked
    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.

  3. bnoordhuis commented on Jun 30, 2015

    @bnoordhuis
    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.

  4. bripkens commented on Dec 28, 2015

    @bripkens
    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.

  5. bripkens commented on Dec 29, 2015

    @bripkens
    Contributor

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

  6. bnoordhuis commented on Dec 29, 2015

    @bnoordhuis
    Member

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

  7. bripkens commented on Dec 29, 2015

    @bripkens
    Contributor

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

  8. 1 remaining item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions