You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/01/06 14:11:31 UTC
git commit: Make the scale down decesion based on Load average and
memory consumption
Updated Branches:
refs/heads/master cf6c82320 -> 04a16d02f
Make the scale down decesion based on Load average and memory consumption
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/04a16d02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/04a16d02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/04a16d02
Branch: refs/heads/master
Commit: 04a16d02f054cafae12320061f7c552eea118eb4
Parents: cf6c823
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Mon Jan 6 18:46:06 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Mon Jan 6 18:46:06 2014 +0530
----------------------------------------------------------------------
.../autoscaler/monitor/ClusterMonitor.java | 6 +-
.../distribution/src/main/conf/scaling.drl | 71 ++++++++++++--------
2 files changed, 47 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/04a16d02/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java
index b39c8ca..477e001 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java
@@ -103,9 +103,9 @@ public class ClusterMonitor extends AbstractMonitor{
scaleCheckKnowledgeSession.setGlobal("clusterId", clusterId);
//scaleCheckKnowledgeSession.setGlobal("deploymentPolicy", deploymentPolicy);
scaleCheckKnowledgeSession.setGlobal("autoscalePolicy", autoscalePolicy);
- scaleCheckKnowledgeSession.setGlobal("rif", rifReset);
- scaleCheckKnowledgeSession.setGlobal("memoryConsumption", memoryConsumptionReset);
- scaleCheckKnowledgeSession.setGlobal("loadAverage", loadAverageReset);
+ scaleCheckKnowledgeSession.setGlobal("rifReset", rifReset);
+ scaleCheckKnowledgeSession.setGlobal("mcReset", memoryConsumptionReset);
+ scaleCheckKnowledgeSession.setGlobal("laReset", loadAverageReset);
if (log.isDebugEnabled()) {
log.debug(String.format("Running scale check for network partition %s ", networkPartitionContext.getId()));
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/04a16d02/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 d32215a..a41cf11 100644
--- a/products/autoscaler/modules/distribution/src/main/conf/scaling.drl
+++ b/products/autoscaler/modules/distribution/src/main/conf/scaling.drl
@@ -55,22 +55,19 @@ global java.lang.Boolean mcReset;
global java.lang.Boolean laReset;
-rule "Scale-up Rule: Rif"
+rule "Scale-up Rule"
dialect "mvel"
when
$networkPartitionContext : NetworkPartitionContext ()
- eval(log.debug("Running scale up rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId))
$loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
algorithmName : String() from $networkPartitionContext.getPartitionAlgorithm();
- eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName))
-
autoscaleAlgorithm : AutoscaleAlgorithm() from $delegator.getAutoscaleAlgorithm(algorithmName)
+
+ eval(log.debug("Running scale up rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId))
+ eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName))
eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm: " + autoscaleAlgorithm))
- partition : Partition() from autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId)
- eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " Partition is null: " + (partition == null)))
- eval(partition != null)
rifAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight()
rifGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient()
@@ -98,13 +95,18 @@ dialect "mvel"
eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " MC predicted value: " + mcPredictedValue))
eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " MC average limit: " + mcAverageLimit))
- eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " LA redicted value: " + laPredictedValue))
+ eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " LA predicted value: " + laPredictedValue))
eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " LA Average limit: " + laAverageLimit))
eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scale-up factor: " + $delegator.SCALE_UP_FACTOR))
eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scale-up action: " + scaleUpAction))
eval(scaleUpAction)
+
+ partition : Partition() from autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId)
+ eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " Partition is null: " + (partition == null)))
+ eval(partition != null)
+
then
log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scaling up cluster");
$delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef);
@@ -115,38 +117,53 @@ rule "Scaler-down Rule"
dialect "mvel"
when
$networkPartitionContext : NetworkPartitionContext ()
- eval(log.debug("Running scale down rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId))
$loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds()
algorithmName : String() from $networkPartitionContext.getPartitionAlgorithm();
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName))
-
autoscaleAlgorithm : AutoscaleAlgorithm() from $delegator.getAutoscaleAlgorithm(algorithmName)
+
+ eval(log.debug("Running scale down rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId))
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName))
eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm: " + autoscaleAlgorithm))
- partition : Partition() from autoscaleAlgorithm.getNextScaleDownPartition($networkPartitionContext, clusterId)
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " Partition is null: " + (partition == null)))
- eval(partition != null)
+ rifAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight()
+ rifGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient()
+ rifSecondDerivative : Float() from $networkPartitionContext.getRequestsInFlightSecondDerivative()
+ rifAverageLimit : Float() from $loadThresholds.getRequestsInFlight().getAverage()
+ rifPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(rifAverage, rifGradient, rifSecondDerivative, 1)
- lbStatAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight()
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " In-flight request average: " + lbStatAverage))
+ memoryConsumptionAverage : Float() from $networkPartitionContext.getAverageMemoryConsumption()
+ memoryConsumptionGradient : Float() from $networkPartitionContext.getMemoryConsumptionGradient()
+ memoryConsumptionSecondDerivative : Float() from $networkPartitionContext.getMemoryConsumptionSecondDerivative()
+ mcAverageLimit : Float() from $loadThresholds.getMemoryConsumption().getAverage()
+ mcPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(memoryConsumptionAverage, memoryConsumptionGradient, memoryConsumptionSecondDerivative, 1)
- lbStatGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient()
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " In-flight request gradient: " + lbStatGradient))
+ loadAverageAverage : Float() from $networkPartitionContext.getAverageLoadAverage()
+ loadAverageGradient : Float() from $networkPartitionContext.getLoadAverageGradient()
+ loadAverageSecondDerivative : Float() from $networkPartitionContext.getLoadAverageSecondDerivative()
+ laAverageLimit : Float() from $loadThresholds.getLoadAverage().getAverage()
+ laPredictedValue : Double() from $delegator.getPredictedValueForNextMinute(loadAverageAverage, loadAverageGradient, loadAverageSecondDerivative, 1)
- lbStatSecondDerivative : Float() from $networkPartitionContext.getRequestsInFlightSecondDerivative()
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " In-flight request second derivative: " + lbStatSecondDerivative))
+ scaleDownAction : Boolean() from ((rifReset && (rifPredictedValue < rifAverageLimit * $delegator.SCALE_DOWN_FACTOR)) || (mcReset && (mcPredictedValue < mcAverageLimit * $delegator.SCALE_DOWN_FACTOR)) || (laReset && (laPredictedValue < laAverageLimit * $delegator.SCALE_DOWN_FACTOR)))
- averageLimit : Float() from $loadThresholds.getRequestsInFlight().getAverage()
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Average limit: " + averageLimit))
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " RIF predicted value: " + rifPredictedValue))
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " RIF average limit: " + rifAverageLimit))
- predictedValue : Double() from $delegator.getPredictedValueForNextMinute(lbStatAverage, lbStatGradient, lbStatSecondDerivative, 1)
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Predicted value: " + predictedValue))
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " MC predicted value: " + mcPredictedValue))
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " MC average limit: " + mcAverageLimit))
+
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " LA predicted value: " + laPredictedValue))
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " LA Average limit: " + laAverageLimit))
eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scale-down factor: " + $delegator.SCALE_DOWN_FACTOR))
- scaleDown : Boolean() from (predictedValue < averageLimit * $delegator.SCALE_DOWN_FACTOR)
- eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scale-down action: " + scaleDown))
- eval(scaleDown)
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scale-down action: " + scaleDownAction))
+
+ eval(scaleDownAction)
+
+ partition : Partition() from autoscaleAlgorithm.getNextScaleDownPartition($networkPartitionContext, clusterId)
+ eval(partition != null)
+ eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " Partition is null: " + (partition == null)))
+
then
MemberStatsContext selectedMemberStatsContext = null;