This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
JVM decider #326
Merged
Merged
JVM decider #326
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5274a13
JVM decider framework
rguo-aws c11c54b
Merge branch 'master' into rguo-jvm-decider
rguo-aws 3ffecf2
Address PR comments
rguo-aws a8cea38
Add UTs, WIP
rguo-aws 848c6a7
Merge remote-tracking branch 'origin' into rguo-jvm-decider
rguo-aws ead5c04
Address PR comments
rguo-aws 158721b
clean up code
rguo-aws 64d3f72
Merge remote-tracking branch 'origin' into rguo-jvm-decider
rguo-aws e9c6ead
rebase to the latest master
rguo-aws 38366cd
Address more PR comments
rguo-aws d7ef339
Address more comments
rguo-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
83 changes: 83 additions & 0 deletions
83
...istro/elasticsearch/performanceanalyzer/decisionmaker/deciders/jvm/HeapHealthDecider.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package com.amazon.opendistro.elasticsearch.performanceanalyzer.decisionmaker.deciders.jvm; | ||
|
||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.decisionmaker.actions.Action; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.decisionmaker.deciders.Decider; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.decisionmaker.deciders.Decision; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.decisionmaker.deciders.jvm.old_gen.OldGenDecisionPolicy; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.flow_units.ResourceFlowUnit; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.summaries.HotClusterSummary; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.summaries.HotNodeSummary; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.summaries.HotResourceSummary; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.summaries.ResourceUtil; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.store.rca.HighHeapUsageClusterRca; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.store.rca.cluster.NodeKey; | ||
import java.util.List; | ||
|
||
/** | ||
* decider to bring down heap usage in young gen / old gen | ||
*/ | ||
public class HeapHealthDecider extends Decider { | ||
|
||
public static final String NAME = "HeapHealthDecider"; | ||
private final HighHeapUsageClusterRca highHeapUsageClusterRca; | ||
private final OldGenDecisionPolicy oldGenDecisionPolicy; | ||
private int counter = 0; | ||
|
||
public HeapHealthDecider(int decisionFrequency, final HighHeapUsageClusterRca highHeapUsageClusterRca) { | ||
//TODO : refactor parent class to remove evalIntervalSeconds completely | ||
super(5, decisionFrequency); | ||
this.highHeapUsageClusterRca = highHeapUsageClusterRca; | ||
oldGenDecisionPolicy = new OldGenDecisionPolicy(this.getAppContext(), rcaConf); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public Decision operate() { | ||
Decision decision = new Decision(System.currentTimeMillis(), NAME); | ||
counter += 1; | ||
if (counter < decisionFrequency) { | ||
return decision; | ||
} | ||
|
||
counter = 0; | ||
if (highHeapUsageClusterRca.getFlowUnits().isEmpty()) { | ||
return decision; | ||
} | ||
|
||
ResourceFlowUnit<HotClusterSummary> flowUnit = highHeapUsageClusterRca.getFlowUnits().get(0); | ||
if (!flowUnit.hasResourceSummary()) { | ||
return decision; | ||
} | ||
HotClusterSummary clusterSummary = flowUnit.getSummary(); | ||
for (HotNodeSummary nodeSummary : clusterSummary.getHotNodeSummaryList()) { | ||
NodeKey esNode = new NodeKey(nodeSummary.getNodeID(), nodeSummary.getHostAddress()); | ||
for (HotResourceSummary resource : nodeSummary.getHotResourceSummaryList()) { | ||
if (resource.getResource().equals(ResourceUtil.OLD_GEN_HEAP_USAGE)) { | ||
List<Action> actions = oldGenDecisionPolicy.actions(esNode, resource.getValue()); | ||
actions.forEach(decision::addAction); | ||
} | ||
//TODO : Add policy for young gen | ||
} | ||
} | ||
return decision; | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1