Report ZGC individual collections instead of cycles (#445)#447
Merged
karianna merged 5 commits intomicrosoft:mainfrom Jun 23, 2025
Merged
Report ZGC individual collections instead of cycles (#445)#447karianna merged 5 commits intomicrosoft:mainfrom
karianna merged 5 commits intomicrosoft:mainfrom
Conversation
Previously, the ZGC parser would attempt to construct a single event for each minor/major cycle, with each minor cycle containing a single young collection, and each major cycle containing a single young and a single old collection. This created a few problems. First, the implementation of the parser assumed that only one cycle could be active at any given time. As a result, any time a minor cycle started before the previous major cycle was finished, all data collected about the major cycle would be lost. Second, the data model for a MajorZGCCycle assumed there could be only one young collection per cycle. This is not the case. There can be (and frequently are) multiple young collections in a major cycle. Even if the implementation and datamodel were fixed to account for the concurrent nature of generational ZGC, grouping collections by cycle would still create API usability problems. Individual collections within a cycle independently report various JVM/heap level metrics at specific points in time. Within a single major cycle, those points in time may be very far apart, and overlap with a large number of minor cycles. If an end user wished to construct a timeline for a particular metric (for example, heap occupancy), they would need to traverse all the reported cycles, extract the metrics from the individual collections, and put them in order. To address the above issues, the parser and data models are refactored to report each individual collection (young, old, or full) immediately once they are completed instead of waiting until the parent cycle is done. The parser maintains 3 independent forward references (one for each collection type: old, young, and full). As a result, the parser will not lose state even when lines from an old collection are intermixed with lines from a young collection.
Contributor
Author
|
@microsoft-github-policy-service agree company="IMC Markets N.A." |
Contributor
Author
|
There's still a few minor naming inconsistencies I'd like to resolve (i.e. |
karianna
previously approved these changes
Jun 13, 2025
Member
karianna
left a comment
There was a problem hiding this comment.
This looks clean to me overall
Member
dsgrieve
reviewed
Jun 16, 2025
Contributor
dsgrieve
left a comment
There was a problem hiding this comment.
LGTM. This change does break API.
Member
Fair, would require version bump if we're being semantic |
karianna
previously approved these changes
Jun 16, 2025
karianna
approved these changes
Jun 23, 2025
This was referenced Feb 26, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the ZGC parser would attempt to construct a single event for each minor/major cycle, with each minor cycle containing a single young collection, and each major cycle containing a single young and a single old collection.
This created a few problems.
First, the implementation of the parser assumed that only one cycle could be active at any given time. As a result, any time a minor cycle started before the previous major cycle was finished, all data collected about the major cycle would be lost.
Second, the data model for a MajorZGCCycle assumed there could be only one young collection per cycle. This is not the case. There can be (and frequently are) multiple young collections in a major cycle.
Even if the implementation and datamodel were fixed to account for the concurrent nature of generational ZGC, grouping collections by cycle would still create API usability problems. Individual collections within a cycle independently report various JVM/heap level metrics at specific points in time. Within a single major cycle, those points in time may be very far apart, and overlap with a large number of minor cycles. If an end user wished to construct a timeline for a particular metric (for example, heap occupancy), they would need to traverse all the reported cycles, extract the metrics from the individual collections, and put them in order.
To address the above issues, the parser and data models are refactored to report each individual collection (young, old, or full) immediately once they are completed instead of waiting until the parent cycle is done. The parser maintains 3 independent forward references (one for each collection type: old, young, and full). As a result, the parser will not lose state even when lines from an old collection are intermixed with lines from a young collection.