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/13 07:46:43 UTC

git commit: Adjusting logs and cleaning comments

Updated Branches:
  refs/heads/master b8d7d0c59 -> 1aded3057


Adjusting logs and cleaning comments


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

Branch: refs/heads/master
Commit: 1aded3057e8499dbc37bc000437cb50d47007617
Parents: b8d7d0c
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Mon Jan 13 12:20:59 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Mon Jan 13 12:20:59 2014 +0530

----------------------------------------------------------------------
 .../autoscaler/algorithm/OneAfterAnother.java   |  23 +-
 .../autoscaler/algorithm/RoundRobin.java        |  16 +-
 .../health/AutoscalerHealthStatReceiver.java    | 496 +++----------------
 .../autoscaler/rule/RuleTasksDelegator.java     |   3 -
 .../distribution/src/main/conf/scaling.drl      |   7 +-
 5 files changed, 78 insertions(+), 467 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1aded305/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
index 1d69cbd..985814e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
@@ -60,16 +60,12 @@ public class OneAfterAnother implements AutoscaleAlgorithm {
                     Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
                     String currentPartitionId = currentPartition.getId();
 
-//                if (networkPartitionContext.partitionCountExists(currentPartitionId)) {
-//                    networkPartitionContext.addPartitionCount(currentPartitionId, 0);
-//                }
-
                     if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) < currentPartition.getPartitionMax()) {
                         // current partition is free
-//                    networkPartitionContext.increaseMemberCountOfPartition(currentPartitionId, 1);
                         if (log.isDebugEnabled())
-                            log.debug("Free space found in partition " + currentPartition.getId());
-
+                            log.debug(String.format("A free space found for scale down in partition %s [current] %s [max] %s",
+                                    currentPartitionId, networkPartitionContext.getMemberCountOfPartition(currentPartitionId),
+                                                                    currentPartition.getPartitionMax()))  ;
                         return currentPartition;
                     } else {
                         // last partition is reached which is not free
@@ -85,7 +81,7 @@ public class OneAfterAnother implements AutoscaleAlgorithm {
             }
 
             if (log.isDebugEnabled())
-                log.debug("No free partition found at network partition " + networkPartitionContext);
+                log.debug(String.format("No free partition found at network partition %s" , networkPartitionContext));
         } catch (Exception e) {
             log.error("Could not find next scale up partition", e);
         }
@@ -106,15 +102,18 @@ public class OneAfterAnother implements AutoscaleAlgorithm {
                     // has more than minimum instances.
                     if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) > currentPartition.getPartitionMin()) {
                         // current partition is free
-//                    networkPartitionContext.decreaseMemberCountOfPartition(currentPartitionId, 1);
                         if (log.isDebugEnabled())
-                            log.debug("A free space found for scale down in partition" +
-                                    currentPartition.getId());
+                            log.debug(String.format("A free space found for scale down in partition %s [current] %s [min] %s",
+                                    currentPartitionId, networkPartitionContext.getMemberCountOfPartition(currentPartitionId),
+                                                                    currentPartition.getPartitionMin()))  ;
                         return currentPartition;
                     } else {
                         if (currentPartitionIndex == 0) {
                             if (log.isDebugEnabled())
-                                log.debug("First partition reached with no space to scale down");
+                                log.debug(String.format("Partition %s reached with no space to scale down," +
+                                        "[current] %s [mib] %s", currentPartitionId,
+                                        networkPartitionContext.getMemberCountOfPartition(currentPartitionId),
+                                        currentPartition.getPartitionMin()));
                             return null;
                         }
                         // Set next partition as current partition in Autoscaler Context

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1aded305/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
index 8bf14d6..48912c8 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
@@ -54,16 +54,9 @@ public class RoundRobin implements AutoscaleAlgorithm{
     	        // point to next partition
     	        int nextPartitionIndex = currentPartitionIndex  == noOfPartitions - 1 ? 0 : currentPartitionIndex+1;
     	        networkPartitionContext.setCurrentPartitionIndex(nextPartitionIndex);
-    	        
-    	        // current partition has no partitionid-instanceid info in cluster context
-//	        	if(!networkPartitionContext.partitionCountExists(currentPartitionId))
-//                    AutoscalerContext.getInstance().getMonitor(clusterId)
-//                                                .getNetworkPartitionCtxt(networkPartitionContext.getId())
-//                                                .addPartitionCount(currentPartitionId, 0);
-	        	
+
     	        if(networkPartitionContext.getMemberCountOfPartition(currentPartitionId) < currentPartition.getPartitionMax()){
-    	        	// current partition is free    	        	
-//    	        	networkPartitionContext.increaseMemberCountOfPartition(currentPartitionId, 1);
+    	        	// current partition is free
     	        	if(log.isDebugEnabled())
     	        		log.debug("Free space found in partition " + currentPartition.getId());
 	                return currentPartition;
@@ -108,14 +101,9 @@ public class RoundRobin implements AutoscaleAlgorithm{
                 Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
                 String currentPartitionId = currentPartition.getId();
 
-//                if (!networkPartitionContext.partitionCountExists(currentPartitionId))
-//                    AutoscalerContext.getInstance().getMonitor(clusterId)
-//                            .getNetworkPartitionCtxt(networkPartitionContext.getId())
-//                            .addPartitionCount(currentPartitionId, 0);
                 // has more than minimum instances.
                 if (networkPartitionContext.getMemberCountOfPartition(currentPartitionId) > currentPartition.getPartitionMin()) {
                     // current partition is free
-//                    networkPartitionContext.decreaseMemberCountOfPartition(currentPartitionId, 1);
                     if (log.isDebugEnabled()) {
                         log.debug("Returning partition for scaling down " +
                                   currentPartition.getId());

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1aded305/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
index 25cbcef..db71f57 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
@@ -56,370 +56,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
     public AutoscalerHealthStatReceiver() {
 		this.healthStatReceiver = new HealthStatReceiver(createMessageDelegator());
     }
-//    @Override
-//    public void run() {
-//        if(log.isInfoEnabled()) {
-//            log.info("Health event message delegator started");
-//        }
-//
-//        if(log.isDebugEnabled()) {
-//            log.debug("Waiting for topology to be initialized");
-//        }
-//        while(!TopologyManager.getTopology().isInitialized());
-//
-//        while (!terminate) {
-//            try {
-//                TextMessage message = HealthStatEventMessageQueue.getInstance().take();
-//
-//                String messageText = message.getText();
-//                if (log.isDebugEnabled()) {
-//                    log.debug("Health event message received: [message] " + messageText);
-//                }
-//                Event event = jsonToEvent(messageText);
-//                String eventName = event.getEventName();
-//
-//                if (log.isInfoEnabled()) {
-//                    log.info(String.format("Received event: [event-name] %s", eventName));
-//                }
-//
-//                if (Constants.AVERAGE_REQUESTS_IN_FLIGHT.equals(eventName)) {
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setAverageRequestsInFlight(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//
-//                } else if (Constants.GRADIENT_OF_REQUESTS_IN_FLIGHT.equals(eventName)) {
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setRequestsInFlightGradient(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//
-//                } else if (Constants.SECOND_DERIVATIVE_OF_REQUESTS_IN_FLIGHT.equals(eventName)) {
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setRequestsInFlightSecondDerivative(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                } else if (Constants.MEMBER_FAULT_EVENT_NAME.equals(eventName)) {
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String memberId = event.getProperties().get("member_id");
-//
-//                    if (memberId == null || memberId.isEmpty()) {
-//                        if(log.isErrorEnabled()) {
-//                            log.error("Member id not found in received message");
-//                        }
-//                    } else {
-//                        handleMemberFaultEvent(clusterId, memberId);
-//                    }
-//                } else if(Constants.MEMBER_AVERAGE_LOAD_AVERAGE.equals(eventName)) {
-//                    LoadAverage loadAverage = findLoadAverage(event);
-//                    if(loadAverage != null) {
-//                        String value = event.getProperties().get("value");
-//                        Float floatValue = Float.parseFloat(value);
-//                        loadAverage.setAverage(floatValue);
-//
-//                        if (log.isDebugEnabled()) {
-//                            log.debug(String.format("%s event: [member] %s [value] %s", event, event.getProperties().get("member_id"), value));
-//                        }
-//                    }
-//                } else if(Constants.MEMBER_SECOND_DERIVATIVE_OF_LOAD_AVERAGE.equals(eventName)) {
-//                    LoadAverage loadAverage = findLoadAverage(event);
-//                    if(loadAverage != null) {
-//                        String value = event.getProperties().get("value");
-//                        Float floatValue = Float.parseFloat(value);
-//                        loadAverage.setSecondDerivative(floatValue);
-//
-//                        if (log.isDebugEnabled()) {
-//                            log.debug(String.format("%s event: [member] %s [value] %s", event, event.getProperties().get("member_id"), value));
-//                        }
-//                    }
-//                } else if(Constants.MEMBER_GRADIENT_LOAD_AVERAGE.equals(eventName)) {
-//                    LoadAverage loadAverage = findLoadAverage(event);
-//                    if(loadAverage != null) {
-//                        String value = event.getProperties().get("value");
-//                        Float floatValue = Float.parseFloat(value);
-//                        loadAverage.setGradient(floatValue);
-//
-//                        if (log.isDebugEnabled()) {
-//                            log.debug(String.format("%s event: [member] %s [value] %s", event, event.getProperties().get("member_id"), value));
-//                        }
-//                    }
-//                } else if(Constants.MEMBER_AVERAGE_MEMORY_CONSUMPTION.equals(eventName)) {
-//                    MemoryConsumption memoryConsumption = findMemoryConsumption(event);
-//                    if(memoryConsumption != null) {
-//                        String value = event.getProperties().get("value");
-//                        Float floatValue = Float.parseFloat(value);
-//                        memoryConsumption.setAverage(floatValue);
-//
-//                        if (log.isDebugEnabled()) {
-//                            log.debug(String.format("%s event: [member] %s [value] %s", event, event.getProperties().get("member_id"), value));
-//                        }
-//                    }
-//                } else if(Constants.MEMBER_SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION.equals(eventName)) {
-//                    MemoryConsumption memoryConsumption = findMemoryConsumption(event);
-//                    if(memoryConsumption != null) {
-//                        String value = event.getProperties().get("value");
-//                        Float floatValue = Float.parseFloat(value);
-//                        memoryConsumption.setSecondDerivative(floatValue);
-//
-//                        if (log.isDebugEnabled()) {
-//                            log.debug(String.format("%s event: [member] %s [value] %s", event, event.getProperties().get("member_id"), value));
-//                        }
-//                    }
-//                } else if(Constants.MEMBER_GRADIENT_MEMORY_CONSUMPTION.equals(eventName)) {
-//                    MemoryConsumption memoryConsumption = findMemoryConsumption(event);
-//                    if(memoryConsumption != null) {
-//                        String value = event.getProperties().get("value");
-//                        Float floatValue = Float.parseFloat(value);
-//                        memoryConsumption.setGradient(floatValue);
-//
-//                        if (log.isDebugEnabled()) {
-//                            log.debug(String.format("%s event: [member] %s [value] %s",event, event.getProperties().get("member_id"), value));
-//                        }
-//                    }
-//
-//                } else if(Constants.AVERAGE_LOAD_AVERAGE.equals(eventName)) {
-//
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setAverageLoadAverage(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                } else if(Constants.SECOND_DERIVATIVE_OF_LOAD_AVERAGE.equals(eventName)) {
-//
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setLoadAverageSecondDerivative(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                } else if(Constants.GRADIENT_LOAD_AVERAGE.equals(eventName)) {
-//
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setLoadAverageGradient(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                } else if(Constants.AVERAGE_MEMORY_CONSUMPTION.equals(eventName)) {
-//
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setAverageMemoryConsumption(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                } else if(Constants.SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION.equals(eventName)) {
-//
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setMemoryConsumptionSecondDerivative(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                } else if(Constants.GRADIENT_MEMORY_CONSUMPTION.equals(eventName)) {
-//
-//                    String clusterId = event.getProperties().get("cluster_id");
-//                    String networkPartitionId = event.getProperties().get("network_partition_id");
-//                    String value = event.getProperties().get("value");
-//                    Float floatValue = Float.parseFloat(value);
-//
-//                    if (log.isDebugEnabled()) {
-//                        log.debug(String.format("%s event: [cluster] %s [network-partition] %s [value] %s", eventName,
-//                                clusterId, networkPartitionId, value));
-//                    }
-//                    AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
-//                    if(null != monitor){
-//                        NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
-//                        if(null != networkPartitionContext){
-//                            networkPartitionContext.setMemoryConsumptionGradient(floatValue);
-//                        } else {
-//                            if(log.isErrorEnabled()) {
-//                               log.error(String.format("Network partition context is not available for :" +
-//                                       " [network partition] %s", networkPartitionId));
-//                            }
-//                        }
-//                    } else {
-//
-//                        if(log.isErrorEnabled()) {
-//                           log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
-//                        }
-//                    }
-//                }
-//            } catch (Exception e) {
-//                log.error("Failed to retrieve the health stat event message.", e);
-//            }
-//        }
-//        log.warn("Health event Message delegater is terminated");
-//    }
-//
 
     @Override
     public void run() {
@@ -470,19 +106,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setAverageLoadAverage(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -513,11 +148,10 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
 
                 if(null != monitor){
@@ -525,8 +159,8 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                     if(null != networkPartitionContext){
                         networkPartitionContext.setAverageMemoryConsumption(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -556,19 +190,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setAverageRequestsInFlight(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -597,19 +230,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setLoadAverageGradient(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -639,19 +271,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 };
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setMemoryConsumptionGradient(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -680,19 +311,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setRequestsInFlightGradient(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -839,19 +469,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setLoadAverageSecondDerivative(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -881,19 +510,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setMemoryConsumptionSecondDerivative(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -922,19 +550,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                 }else if(asCtx.lbMoniterExist(clusterId)){
                     monitor = asCtx.getLBMonitor(clusterId);
                 }else{
-                    String errMsg = "A monitor is not found for this cluster";
-                    if(log.isErrorEnabled()){
-                        log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                    if(log.isDebugEnabled()){
+                        log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                     }
-                    throw new RuntimeException(errMsg);
+                    return;
                 }
                 if(null != monitor){
                     NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
                     if(null != networkPartitionContext){
                         networkPartitionContext.setRequestsInFlightSecondDerivative(floatValue);
                     } else {
-                        if(log.isErrorEnabled()) {
-                           log.error(String.format("Network partition context is not available for :" +
+                        if(log.isDebugEnabled()) {
+                           log.debug(String.format("Network partition context is not available for :" +
                                    " [network partition] %s", networkPartitionId));
                         }
                     }
@@ -967,19 +594,18 @@ public class AutoscalerHealthStatReceiver implements Runnable {
         }else if(asCtx.lbMoniterExist(clusterId)){
             monitor = asCtx.getLBMonitor(clusterId);
         }else{
-            String errMsg = "A monitor is not found for this cluster";
-            if(log.isErrorEnabled()){
-                log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+            if(log.isDebugEnabled()){
+                log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
             }
-            throw new RuntimeException(errMsg);
+            return null;
         }
         String networkPartitionId = findNetworkPartitionId(memberId);
         MemberStatsContext memberStatsContext = monitor.getNetworkPartitionCtxt(networkPartitionId)
                         .getPartitionCtxt(member.getPartitionId())
                         .getMemberStatsContext(memberId);
         if(null == memberStatsContext){
-            if(log.isErrorEnabled()) {
-               log.error(String.format("Member context is not available for : [member] %s", memberId));
+            if(log.isDebugEnabled()) {
+               log.debug(String.format("Member context is not available for : [member] %s", memberId));
             }
             return null;
         }
@@ -1000,8 +626,8 @@ public class AutoscalerHealthStatReceiver implements Runnable {
         Member member = findMember(memberId);
         
         if(null == member){
-        	if(log.isErrorEnabled()) {
-                log.error(String.format("Member not found in the Topology : [member] %s", memberId));
+        	if(log.isDebugEnabled()) {
+                log.debug(String.format("Member not found in the Topology : [member] %s", memberId));
             }
         	return null;
         }
@@ -1011,8 +637,8 @@ public class AutoscalerHealthStatReceiver implements Runnable {
 
             monitor = AutoscalerContext.getInstance().getLBMonitor(member.getClusterId());
             if(null == monitor){
-                if(log.isErrorEnabled()) {
-                   log.error(String.format("Cluster monitor is not available for : [member] %s", memberId));
+                if(log.isDebugEnabled()) {
+                   log.debug(String.format("Cluster monitor is not available for : [member] %s", memberId));
                 }
             }
             return null;
@@ -1023,8 +649,8 @@ public class AutoscalerHealthStatReceiver implements Runnable {
                         .getPartitionCtxt(member.getPartitionId())
                         .getMemberStatsContext(memberId);
         if(null == memberStatsContext){
-            if(log.isErrorEnabled()) {
-               log.error(String.format("Member context is not available for : [member] %s", memberId));
+            if(log.isDebugEnabled()) {
+               log.debug(String.format("Member context is not available for : [member] %s", memberId));
             }
             return null;
         }else if(!member.isActive()){
@@ -1077,11 +703,10 @@ public class AutoscalerHealthStatReceiver implements Runnable {
         	}else if(asCtx.lbMoniterExist(clusterId)){
         		monitor = asCtx.getLBMonitor(clusterId);
         	}else{
-        		String errMsg = "A monitor is not found for this cluster";
-                if(log.isErrorEnabled()){
-                    log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+                if(log.isDebugEnabled()){
+                    log.debug(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
                 }
-        		throw new RuntimeException(errMsg);
+                return;
         	}
         	
         	NetworkPartitionContext nwPartitionCtxt;
@@ -1119,7 +744,8 @@ public class AutoscalerHealthStatReceiver implements Runnable {
             if (log.isInfoEnabled()) {
                 log.info(String.format("Instance spawned for fault member: [partition] %s [cluster] %s [lb cluster] %s ", 
                                        partitionId, clusterId, lbClusterId));
-            }                       
+            }
+
 
         } catch (TerminationException e) {
             log.error(e);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1aded305/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 fe83a4e..c92955c 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
@@ -33,9 +33,6 @@ public class RuleTasksDelegator {
         }
         predictedValue = average + gradient * timeInterval + 0.5 * secondDerivative * timeInterval * timeInterval;
 
-        if(log.isDebugEnabled()){
-            log.debug(String.format("Predicted value: %s ", predictedValue));
-        }
         return predictedValue;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1aded305/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 3e4aded..62136c4 100644
--- a/products/autoscaler/modules/distribution/src/main/conf/scaling.drl
+++ b/products/autoscaler/modules/distribution/src/main/conf/scaling.drl
@@ -109,7 +109,7 @@ dialect "mvel"
 
             Partition partition =  autoscaleAlgorithm.getNextScaleUpPartition($networkPartitionContext, clusterId);
             if(partition != null){
-                log.debug("[scaling up] Partition available to scale up ");
+                log.info("[scale-up] Partition available, hence trying to spawn an instance to scale up!" );
                 log.debug("[scaling up] " + " [partition] " + partition.getId() + " [cluster] " + clusterId);
                 $delegator.delegateSpawn($networkPartitionContext.getPartitionCtxt(partition.getId()), clusterId, lbRef);
             }
@@ -120,7 +120,7 @@ dialect "mvel"
             boolean foundAValue = false;
             Partition partition =  autoscaleAlgorithm.getNextScaleDownPartition($networkPartitionContext, clusterId);
             if(partition != null){
-                log.debug("[scaling down] Partition available to scale up ");
+                log.info("[scaling down] Partition available to scale down ");
                 log.debug("[scaling down] " + " [partition] " + partition.getId() + " [cluster] " + clusterId);
                 partitionContext = $networkPartitionContext.getPartitionCtxt(partition.getId());
 
@@ -156,6 +156,7 @@ dialect "mvel"
                     }
                 }
                 if(selectedMemberStatsContext != null) {
+                    log.info("[scale-down] Trying to terminating an instace to scale down!" );
                     log.debug("[scale-down] " + " [partition] " + partition.getId() + " [cluster] "
                         + clusterId + " Member with lowest overall load: " + selectedMemberStatsContext.getMemberId());
 
@@ -163,7 +164,7 @@ dialect "mvel"
                 }
             }
         }  else{
-            log.debug("[scaling] No decision made to scale up or down ... ");
+            log.debug("[scaling] No decision made to either scale up or scale down ... ");
 
         }