Updated Branches: refs/heads/master 19217e3c4 -> 5f9188065
Added more logs to drools files Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/5f918806 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/5f918806 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/5f918806 Branch: refs/heads/master Commit: 5f9188065adcc7d4b12404b1c31a93fa5d1351ea Parents: 19217e3 Author: Imesh Gunaratne <[email protected]> Authored: Fri Dec 27 12:16:10 2013 +0530 Committer: Imesh Gunaratne <[email protected]> Committed: Fri Dec 27 12:16:10 2013 +0530 ---------------------------------------------------------------------- .../distribution/src/main/conf/mincheck.drl | 10 +-- .../distribution/src/main/conf/scaling.drl | 71 ++++++++++++-------- 2 files changed, 48 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5f918806/products/autoscaler/modules/distribution/src/main/conf/mincheck.drl ---------------------------------------------------------------------- diff --git a/products/autoscaler/modules/distribution/src/main/conf/mincheck.drl b/products/autoscaler/modules/distribution/src/main/conf/mincheck.drl index 69a7b07..b7bf7e0 100755 --- a/products/autoscaler/modules/distribution/src/main/conf/mincheck.drl +++ b/products/autoscaler/modules/distribution/src/main/conf/mincheck.drl @@ -53,9 +53,9 @@ rule "Minimum Rule" dialect "mvel" when $ctxt : PartitionContext () - eval(log.debug("Running minimum rule: [partition] " + $ctxt.getPartitionId() + " [network-partition] " + $ctxt.getNetworkPartitionId())) - eval(log.debug("total member count: " + $ctxt.getTotalMemberCount())) - eval(log.debug("minimum member count: " + $ctxt.getMinimumMemberCount())) + eval(log.debug("Running minimum rule: [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId())) + eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Total member count: " + $ctxt.getTotalMemberCount())) + eval(log.debug("[min-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Minimum member count: " + $ctxt.getMinimumMemberCount())) eval($ctxt.getTotalMemberCount() < $ctxt.getMinimumMemberCount()) then @@ -68,10 +68,10 @@ dialect "mvel" when $ctxt : PartitionContext () eval(log.debug("Running obsolete instances rule: [partition] " + $ctxt.getPartitionId() + " [network-partition] " + $ctxt.getNetworkPartitionId())) - eval(log.debug("obsolete member count: " + $ctxt.getObsoletedMembers().size())) + eval(log.debug("[obsolete-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() +" Obsolete member count: " + $ctxt.getObsoletedMembers().size())) eval($ctxt.getObsoletedMembers().size() > 0) memberId : String() from $ctxt.getObsoletedMembers() - eval(log.debug("member id: " + memberId)) + eval(log.debug("[obsolete-check] [network-partition] " + $ctxt.getNetworkPartitionId() + " [partition] " + $ctxt.getPartitionId() + " Member id: " + memberId)) eval($ctxt.removeObsoleteMember(memberId)) then $delegator.delegateTerminate(memberId); http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5f918806/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 5d3b6c9..a2ed7b6 100644 --- a/products/autoscaler/modules/distribution/src/main/conf/scaling.drl +++ b/products/autoscaler/modules/distribution/src/main/conf/scaling.drl @@ -57,30 +57,34 @@ 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("algorithm name " + algorithmName)) + eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId + " Algorithm name: " + algorithmName)) + autoscaleAlgorithm : AutoscaleAlgorithm() from $delegator.getAutoscaleAlgorithm(algorithmName) - eval(log.debug("algorithm " + autoscaleAlgorithm)) + 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) + lbStatAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight() lbStatGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient() lbStatSecondDerivative : Float() from $networkPartitionContext.getRequestsInFlightSecondDerivative() averageLimit : Float() from $loadThresholds.getRequestsInFlight().getAverage() - partition : Partition() from autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId) - eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " Partition is null: " + (partition == null))) - eval(partition != null) predictedValue : Double() from $delegator.getPredictedValueForNextMinute(lbStatAverage, lbStatGradient, lbStatSecondDerivative, 1) scaleUpAction : Boolean() from (predictedValue > averageLimit * $delegator.SCALE_UP_FACTOR) - eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + clusterId + " Predicted value: " + predictedValue)) - eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + clusterId + " Average limit: " + averageLimit)) - 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(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Predicted value: " + predictedValue)) + eval(log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Average limit: " + averageLimit)) + 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) then - log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + clusterId + " Scaling up cluster"); + log.debug("[scale-up] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Scaling up cluster"); $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef); end @@ -90,25 +94,36 @@ dialect "mvel" when $networkPartitionContext : NetworkPartitionContext () eval(log.debug("Running scale down rule: [network-partition] " + $networkPartitionContext.getId() + " [cluster] " + clusterId)) + $loadThresholds : LoadThresholds() from autoscalePolicy.getLoadThresholds() - autoscaleAlgorithm : AutoscaleAlgorithm() from $delegator.getAutoscaleAlgorithm($networkPartitionContext.getPartitionAlgorithm()) + 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("[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) + lbStatAverage : Float() from $networkPartitionContext.getAverageRequestsInFlight() + eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " In-flight request average: " + lbStatAverage)) + lbStatGradient : Float() from $networkPartitionContext.getRequestsInFlightGradient() + eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " In-flight request gradient: " + lbStatGradient)) + 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)) + averageLimit : Float() from $loadThresholds.getRequestsInFlight().getAverage() + eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Average limit: " + averageLimit)) - partition : Partition() from autoscaleAlgorithm.getNextScaleDownPartition($networkPartitionContext, clusterId) - eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " Partition is null: " + (partition == null))) - eval(partition != null) predictedValue : Float() from $delegator.getPredictedValueForNextMinute(lbStatAverage, lbStatGradient, lbStatSecondDerivative, 1) - scaleDown : Boolean() from (predictedValue < averageLimit * $delegator.SCALE_DOWN_FACTOR) - - 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 + " Predicted value: " + predictedValue)) - 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 + " Scale-down factor: " + $delegator.SCALE_DOWN_FACTOR)) - eval(log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + clusterId + " Scale-down action: " + scaleDown)) + 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 + " 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) then @@ -119,23 +134,23 @@ dialect "mvel" for(MemberStatsContext memberStatsContext: partitionContext.getMemberStatsContexts().values()){ LoadAverage loadAverage = memberStatsContext.getLoadAverage(); - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " [member] " + memberStatsContext.getMemberId() + " Load average: " + loadAverage.toString()); MemoryConsumption memoryConsumption = memberStatsContext.getMemoryConsumption(); - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " [member] " + memberStatsContext.getMemberId() + " Memory consumption: " + memoryConsumption.toString()); double predictedCpu = $delegator.getPredictedValueForNextMinute(loadAverage.getAverage(),loadAverage.getGradient(),loadAverage.getSecondDerivative(), 1); - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " [member] " + memberStatsContext.getMemberId() + " Predicted CPU: " + predictedCpu); double predictedMemoryConsumption = $delegator.getPredictedValueForNextMinute(memoryConsumption.getAverage(),memoryConsumption.getGradient(),memoryConsumption.getSecondDerivative(), 1); - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " [member] " + memberStatsContext.getMemberId() + " Predicted memory consumption: " + predictedMemoryConsumption); double overallLoad = (predictedCpu + predictedMemoryConsumption) / 2; - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " [member] " + memberStatsContext.getMemberId() + " Overall load: " + overallLoad); if(!foundAValue){ @@ -148,13 +163,13 @@ dialect "mvel" } if(selectedMemberStatsContext != null) { - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Member with lowest overall load: " + memberStatsContext.getMemberId()); } } } if(selectedMemberStatsContext != null) { - log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition]" + partition.getId() + " [cluster] " + clusterId + log.debug("[scale-down] [network-partition] " + $networkPartitionContext.getId() + " [partition] " + partition.getId() + " [cluster] " + clusterId + " Terminating member: " + selectedMemberStatsContext.getMemberId()); $delegator.delegateTerminate(selectedMemberStatsContext.getMemberId()); }
