stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lahi...@apache.org
Subject [1/3] stratos git commit: improve scaling up logic in scaling rule
Date Fri, 26 Dec 2014 15:31:08 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 9cd4e89b1 -> 35f156d48


improve scaling up logic in scaling rule


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d8a52fc0
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d8a52fc0
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d8a52fc0

Branch: refs/heads/master
Commit: d8a52fc04d05ca91c3c223ed9ca94de6e330635c
Parents: 9cd4e89
Author: Lahiru Sandaruwan <lahirus@apache.org>
Authored: Fri Dec 26 14:18:28 2014 +0530
Committer: Lahiru Sandaruwan <lahirus@apache.org>
Committed: Fri Dec 26 20:50:01 2014 +0530

----------------------------------------------------------------------
 .../src/main/conf/drools/scaling.drl            | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d8a52fc0/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
index 3af79c0..4260426 100644
--- a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
+++ b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
@@ -119,9 +119,21 @@ dialect "mvel"
 
 	    log.debug("[scaling] Number of required instances based on stats: " + numberOfRequiredInstances
+ " [active instances count] " + activeInstancesCount + " [network-partition] " + clusterInstanceContext.getNetworkPartitionId()
+ " [cluster] " + clusterId);
 
+        int nonTerminatedMemberCount = clusterInstanceContext.getNonTerminatedMemberCount();
         if(scaleUp){
-            if (clusterInstanceContext.getNonTerminatedMemberCount() < clusterInstanceContext.getMaxInstanceCount())
{
-                int additionalInstances = numberOfRequiredInstances - activeInstancesCount
;
+
+            int clusterMaxMembers = clusterInstanceContext.getMaxInstanceCount();
+            if (nonTerminatedMemberCount < clusterMaxMembers) {
+
+                int additionalInstances = 0;
+                if(clusterMaxMembers < numberOfRequiredInstances){
+
+                    additionalInstances = clusterMaxMembers - nonTerminatedMemberCount;
+                } else {
+
+                    additionalInstances = numberOfRequiredInstances - nonTerminatedMemberCount;
+                }
+
                 clusterInstanceContext.resetScaleDownRequestsCount();
 
                 log.debug("[scale-up] " + " has scaling dependents " + clusterInstanceContext.hasScalingDependants()
+ " [cluster] " + clusterId );
@@ -153,12 +165,12 @@ dialect "mvel"
                 log.info("[scale-up] Max is reached, hence not scaling up cluster monitor
itself and
                         notifying to parent for possible group scaling or app bursting.
                         [cluster] " + clusterId + " [instance id]" + clusterInstanceContext.getId()
+
-                        " [max] " + clusterInstanceContext.getMaxInstanceCount());
+                        " [max] " + clusterMaxMembers);
                 delegator.delegateScalingOverMaxNotification(clusterId, clusterInstanceContext.getNetworkPartitionId(),
clusterInstanceContext.getId());
             }
         } else if(scaleDown){
 
-            if(clusterInstanceContext.getNonTerminatedMemberCount() > clusterInstanceContext.getMinInstanceCount){
+            if(nonTerminatedMemberCount > clusterInstanceContext.getMinInstanceCount){
 
                 log.debug("[scale-down] Decided to Scale down [cluster] " + clusterId);
                 if(clusterInstanceContext.getScaleDownRequestsCount() > 2 ){


Mime
View raw message