Updated Branches: refs/heads/master a0d6ce5f3 -> 1f1230cb2
Avoid running scale down rule if it is already decided to scale up Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/45b66181 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/45b66181 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/45b66181 Branch: refs/heads/master Commit: 45b66181912be2ecadad2d8a708dac54a210668c Parents: 9b9c081 Author: Lahiru Sandaruwan <[email protected]> Authored: Fri Jan 10 22:29:29 2014 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Fri Jan 10 22:29:29 2014 +0530 ---------------------------------------------------------------------- .../apache/stratos/autoscaler/rule/RuleTasksDelegator.java | 8 ++++++++ .../modules/distribution/src/main/conf/scaling.drl | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/45b66181/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java index 8cbeb6f..3c589c9 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java @@ -22,6 +22,8 @@ public class RuleTasksDelegator { public static final double SCALE_UP_FACTOR = 0.8; //get from config public static final double SCALE_DOWN_FACTOR = 0.2; + private boolean scaledUp = false; + private static final Log log = LogFactory.getLog(RuleTasksDelegator.class); public double getPredictedValueForNextMinute(float average, float gradient, float secondDerivative, int timeInterval){ @@ -137,5 +139,11 @@ public class RuleTasksDelegator { } + public boolean isScaledUp() { + return scaledUp; + } + public void setScaledUp(boolean scaledUp) { + this.scaledUp = scaledUp; + } } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/45b66181/products/autoscaler/modules/distribution/src/main/conf/scaling.drl ---------------------------------------------------------------------- diff --git a/products/autoscaler/modules/distribution/src/main/conf/scaling.drl b/products/autoscaler/modules/distribution/src/main/conf/scaling.drl index 4656b8a..034afca 100644 --- a/products/autoscaler/modules/distribution/src/main/conf/scaling.drl +++ b/products/autoscaler/modules/distribution/src/main/conf/scaling.drl @@ -106,7 +106,7 @@ dialect "mvel" partition : Partition() from autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId) eval(log.debug("[scale-up] " + " Partition available: " + (partition != null))) eval(partition != null) - + eval($delegator.setScaledUp(true)) then log.debug("[scale-up] " + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scaling up cluster"); $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef); @@ -116,6 +116,10 @@ end rule "Scaler-down Rule" dialect "mvel" when + + eval(!$delegator.isScaledUp()) + eval(log.debug("[scale-down] " + " [cluster] " + clusterId + " Running scale down rule since not scaled up... ")) + $networkPartitionContext : NetworkPartitionContext () $loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
