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

Support for Heap after GC stats #1265

Merged
merged 3 commits into from
Sep 28, 2021
Merged

Conversation

reta
Copy link
Collaborator

@reta reta commented Sep 21, 2021

Signed-off-by: Andriy Redko andriy.redko@aiven.io

Description

JVM stats published today represents the point in time usage of the heap across pools. While
MemoryPoolMXBean::getCollectionUsage provides the memory usage after the Java virtual machine most recently expended effort in recycling unused objects in this memory pool. Exposing this information could be quite helpful while troubleshooting GC and memory issues.

The jvm section of the node statistics had been extended to include the additional details regarding most recent GC cycle for a particular memory pool, under new last_gc_stats section:

            "old" : {                             
              "used_in_bytes" : 50526632,
              "max_in_bytes" : 357957632,
              "peak_used_in_bytes" : 50526632,
              "peak_max_in_bytes" : 357957632,
              "last_gc_stats" : {
                "used_in_bytes" : 42130040,
                "max_in_bytes" : 357957632,
                "usage_percent" : 11
              }                                   
            }  

The sample output:

curl http://localhost:9200/_nodes/stats/jvm?pretty
....
{
        ...
        "pools" : {                                                                                                                                                                                      
            "young" : {                                                                                                                                                                                    
              "used_in_bytes" : 103327560,                                                                                                                                                                 
              "max_in_bytes" : 143130624,                                                                                                                                                                  
              "peak_used_in_bytes" : 143130624,                                                                                                                                                            
              "peak_max_in_bytes" : 143130624,                                                                                                                                                             
              "last_gc_stats" : {                                                                                                                                                                          
                "used_in_bytes" : 73248760,                                                                                                                                                                
                "max_in_bytes" : 143130624,                                                                                                                                                                
                "usage_percent" : 51              
              }                                   
            },                                    
            "survivor" : {                        
              "used_in_bytes" : 17431960,         
              "max_in_bytes" : 17891328,          
              "peak_used_in_bytes" : 17891328,    
              "peak_max_in_bytes" : 17891328,     
              "last_gc_stats" : {          
                "used_in_bytes" : 17431960,       
                "max_in_bytes" : 17891328,
                "usage_percent" : 97              
              }                                   
            },                                    
            "old" : {                             
              "used_in_bytes" : 50526632,
              "max_in_bytes" : 357957632,
              "peak_used_in_bytes" : 50526632,
              "peak_max_in_bytes" : 357957632,
              "last_gc_stats" : {
                "used_in_bytes" : 42130040,
                "max_in_bytes" : 357957632,
                "usage_percent" : 11
              }                                   
            }                                     
          }                                       
        },  
        ...

Issues Resolved

#981

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@reta
Copy link
Collaborator Author

reta commented Sep 21, 2021

@Bukhtawar may I ask you please to take a look, is it something you had mind or there are missing pieces? thank you!

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 80afb4240ddc4d7330820b41c576b65cba628a55

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 80afb4240ddc4d7330820b41c576b65cba628a55

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 80afb4240ddc4d7330820b41c576b65cba628a55

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

LGTM

@dblock
Copy link
Member

dblock commented Sep 21, 2021

start grade check

@@ -299,7 +316,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
static final String PEAK_USED_IN_BYTES = "peak_used_in_bytes";
static final String PEAK_MAX = "peak_max";
static final String PEAK_MAX_IN_BYTES = "peak_max_in_bytes";

static final String USAGE_PERCENT = "usage_percent";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be confused with current usage vs usage after GC?

Copy link
Collaborator Author

@reta reta Sep 22, 2021

Choose a reason for hiding this comment

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

Good question, I think it should not since the field is under last_gc_stats object, in this context, it should not be confusing. Also, the semantic of this field stays consistent between current usage (if we add it there) and usage after GC. What do you think?

@opensearch-ci-bot
Copy link
Collaborator

❌   DCO Check Failed fd80400f525743b740268d4a1b1db6f6aa41374c
Run ./dev-tools/signoff-check.sh remotes/origin/main fd80400f525743b740268d4a1b1db6f6aa41374c to check locally
Use git commit with -s to add 'Signed-of-by: {EMAIL}' on impacted commits

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 2c362e40ab4ed1d3fa3af6b7fd00490fab337c1b

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 2c362e40ab4ed1d3fa3af6b7fd00490fab337c1b

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 2c362e40ab4ed1d3fa3af6b7fd00490fab337c1b

@reta
Copy link
Collaborator Author

reta commented Sep 24, 2021

@Bukhtawar anything pending for this change from your side? thank you! :-)

Copy link
Collaborator

@Bukhtawar Bukhtawar left a comment

Choose a reason for hiding this comment

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

LGTM.. Thanks @reta for the changes

@reta
Copy link
Collaborator Author

reta commented Sep 24, 2021

@dblock may I ask you please to schedule Gradle check? Thank you!

@dblock
Copy link
Member

dblock commented Sep 24, 2021

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 2c362e40ab4ed1d3fa3af6b7fd00490fab337c1b
Log 569

Reports 569

@reta
Copy link
Collaborator Author

reta commented Sep 24, 2021

Gradle Check failure 2c362e4
Log 569

Reports 569

Hm ... Task :distribution:bwc:minor:buildBwcLinuxTar FAILED

> Task :distribution:bwc:staged:buildBwcLinuxTar
 [1.1.0] > Task :distribution:archives:linux-tar:assemble
 [1.1.0] build complete, generating: /var/CITOOL/workflow/OpenSearch_CI/PR_Checks/Gradle_Check/search/distribution/bwc/staged/build/bwc/checkout-1.1/build/569.tar.bz2

> Task :distribution:bwc:minor:buildBwcLinuxTar FAILED
> Task :modules:repository-url:urlFixture#stop

> Task :distribution:bwc:staged:buildBwcLinuxTar
 [1.1.0] 
 [1.1.0] BUILD SUCCESSFUL in 6m 32s
 [1.1.0] 149 actionable tasks: 149 executed

> Task :distribution:bwc:staged:buildBwcLinuxTar FAILED

Same as #1285 ?

@reta
Copy link
Collaborator Author

reta commented Sep 27, 2021

My apologies, @dblock , seems like #1285 was closed, may I ask you please to reschedule the Gradle check whenever you have time, thank you!

@dblock
Copy link
Member

dblock commented Sep 28, 2021

start gradle check

@dblock
Copy link
Member

dblock commented Sep 28, 2021

Thanks for hanging in here! I kicked it, but I think this might need a rebase.

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 2c362e40ab4ed1d3fa3af6b7fd00490fab337c1b
Log 581

Reports 581

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
@reta
Copy link
Collaborator Author

reta commented Sep 28, 2021

Rebased, thanks a lot @dblock !

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed e7155ca

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success e7155ca

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success e7155ca

@dblock
Copy link
Member

dblock commented Sep 28, 2021

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure e7155ca
Log 586

Reports 586

@reta
Copy link
Collaborator Author

reta commented Sep 28, 2021

x Gradle Check failure e7155ca Log 586

Reports 586

On it

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 8dfe9a1

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 8dfe9a1

@dblock
Copy link
Member

dblock commented Sep 28, 2021

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 8dfe9a1

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 8dfe9a1
Log 588

Reports 588

@dblock dblock merged commit 80388a8 into opensearch-project:main Sep 28, 2021
reta added a commit to reta/OpenSearch that referenced this pull request Sep 28, 2021
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
@tlfeng tlfeng added enhancement Enhancement or improvement to existing feature or request v1.2.0 Issues related to version 1.2.0 v2.0.0 Version 2.0.0 labels Sep 29, 2021
dblock pushed a commit that referenced this pull request Sep 29, 2021
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request v1.2.0 Issues related to version 1.2.0 v2.0.0 Version 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants