You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2013/11/26 15:23:58 UTC
[2/2] git commit: Removing rule file inside the autoscaler component
Removing rule file inside the autoscaler component
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/7ac9d577
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/7ac9d577
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/7ac9d577
Branch: refs/heads/master
Commit: 7ac9d57747990d854cc01c45478d0c4315ded3f6
Parents: fbd98ae
Author: Udara Liyanage <ud...@wso2.com>
Authored: Tue Nov 26 19:53:28 2013 -0500
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Tue Nov 26 19:53:28 2013 -0500
----------------------------------------------------------------------
.../src/main/resources/autoscaler.drl | 114 -------------------
1 file changed, 114 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7ac9d577/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl b/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
deleted file mode 100644
index 3ff8f9a..0000000
--- a/components/org.apache.stratos.autoscaler/src/main/resources/autoscaler.drl
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License 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 org.apache.stratos.autoscaler.rule;
-
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.autoscaler.AutoscalerContext;
-import org.apache.stratos.autoscaler.ClusterContext;
-import org.apache.stratos.autoscaler.Constants;
-import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.autoscaler.policy.model.Partition;
-import org.apache.stratos.autoscaler.policy.model.HAPolicy;
-import org.apache.stratos.autoscaler.policy.model.RequestsInFlight;
-import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
-import org.apache.stratos.autoscaler.algorithm.AutoscaleAlgorithm;
-import org.apache.stratos.autoscaler.algorithm.OneAfterAnother;
-import org.apache.stratos.autoscaler.algorithm.RoundRobin;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
-import org.apache.commons.logging.Log;
-
-global org.apache.stratos.autoscaler.policy.PolicyManager $manager;
-global org.apache.stratos.autoscaler.AutoscalerContext $context;
-global org.apache.commons.logging.Log log;
-global org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator $evaluator;
-global org.apache.stratos.messaging.domain.topology.Topology $topology;
-
-
-rule "Minimum Rule"
-dialect "mvel"
- when
- $service : Service ()
- $cluster : Cluster () from $service.getClusters()
- $policy : AutoscalePolicy(id == $cluster.autoscalePolicyName ) from $manager.getPolicyList()
- $partition : Partition () from $policy.getHAPolicy().getPartitions()
- $clusterContext : ClusterContext() from $context.getClusterContext($cluster.getClusterId())
- eval($clusterContext.getPartitionCount($partition.getId()) < $partition.getPartitionMembersMin() )
- then
- int memberCountToBeIncreased = 1;
- if($evaluator.delegateSpawn($partition,$cluster.getClusterId(), memberCountToBeIncreased)){
- $clusterContext.increaseMemberCountInPartition($partition.getId(), memberCountToBeIncreased);
- }
-end
-
-rule "Scaler-up Rule"
-dialect "mvel"
- when
- $service : Service ()
- $cluster : Cluster () from $service.getClusters()
- $policy : AutoscalePolicy(id == $cluster.autoscalePolicyName ) from $manager.getPolicyList()
- $clusterContext : ClusterContext() from $context.getClusterContext($cluster.getClusterId())
- $loadThresholds :LoadThresholds() from $policy.getLoadThresholds()
- autoscaleAlgorithm : AutoscaleAlgorithm() from $evaluator.getAutoscaleAlgorithm($policy.getHAPolicy().getPartitionAlgo())
- lbStatAverage : Float() from $clusterContext.getAverageRequestsInFlight()
- lbStatGradient : Float() from $clusterContext.getRequestsInFlightGradient()
- lbStatSecondDerivative : Float() from $clusterContext.getRequestsInFlightSecondDerivative()
- averageLimit : Float() from $loadThresholds.getRequestsInFlight().getAverage()
- gradientLimit : Float() from $loadThresholds.getRequestsInFlight().getGradient()
- secondDerivative : Float() from $loadThresholds.getRequestsInFlight().getSecondDerivative()
- partition : Partition() from autoscaleAlgorithm.getNextScaleUpPartition($cluster.getClusterId())
- eval (lbStatAverage > averageLimit && lbStatGradient > gradientLimit)
- then
- int numberOfInstancesToBeSpawned = (lbStatSecondDerivative > secondDerivative) ? 2 : 1; // take from a config
- $evaluator.delegateSpawn(partition,$cluster.getClusterId(), numberOfInstancesToBeSpawned);
- $clusterContext.setRequestsInFlightGradient(gradientLimit);
- $clusterContext.setRequestsInFlightSecondDerivative(secondDerivative);
- $clusterContext.setAverageRequestsInFlight(averageLimit);
-end
-
-rule "Scaler-down Rule"
-dialect "mvel"
- when
- $service : Service ()
- $cluster : Cluster () from $service.getClusters()
- $policy : AutoscalePolicy(id == $cluster.autoscalePolicyName ) from $manager.getPolicyList()
- $clusterContext : ClusterContext() from $context.getClusterContext($cluster.getClusterId())
- $loadThresholds :LoadThresholds() from $policy.getLoadThresholds()
- autoscaleAlgorithm : AutoscaleAlgorithm() from $evaluator.getAutoscaleAlgorithm($policy.getHAPolicy().getPartitionAlgo())
- lbStatAverage : Float() from $clusterContext.getAverageRequestsInFlight()
- lbStatGradient : Float() from $clusterContext.getRequestsInFlightGradient()
- lbStatSecondDerivative : Float() from $clusterContext.getRequestsInFlightSecondDerivative()
- averageLimit : Float() from $loadThresholds.getRequestsInFlight().getAverage()
- gradientLimit : Float() from $loadThresholds.getRequestsInFlight().getGradient()
- secondDerivative : Float() from $loadThresholds.getRequestsInFlight().getSecondDerivative()
- scaleDownSlowerMarginOfGradient : Float() from $loadThresholds.getRequestsInFlight().getScaleDownMarginOfGradient()
- scaleDownSlowerMarginOfSecondDerivative : Float() from $loadThresholds.getRequestsInFlight().getScaleDownMarginOfSecondDerivative()
- partition : Partition() from autoscaleAlgorithm.getNextScaleDownPartition($cluster.getClusterId())
- eval(lbStatAverage < averageLimit && lbStatGradient < gradientLimit - scaleDownSlowerMarginOfSecondDerivative
- && lbStatSecondDerivative < secondDerivative - scaleDownSlowerMarginOfSecondDerivative)
- then
- $evaluator.delegateTerminate(partition,$cluster.getClusterId());
- $clusterContext.setRequestsInFlightGradient(gradientLimit);
- $clusterContext.setRequestsInFlightSecondDerivative(secondDerivative);
- $clusterContext.setAverageRequestsInFlight(averageLimit);
-end