Class RuleBasedPredictor

  • All Implemented Interfaces:
    com.elastisys.autoscaler.core.api.Configurable<com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig>, com.elastisys.autoscaler.core.api.Service<com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig>, com.elastisys.autoscaler.core.prediction.impl.standard.api.Predictor

    public class RuleBasedPredictor
    extends com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
    A compute unit predictor that suggests capacity changes from a collection of ScalingRules, defining thresholds for the monitored metric and what scaling actions to take when those thresholds are breached.

    When a threshold has been exceeded (for a sufficiently long time), causing a ScalingRule to fire, the RuleBasedPredictor will enter a "cool-down period" in order for the scaling decision to get some time to take effect. During this cool-down period, no new ScalingRules will be allowed to fire, and the RuleBasedPredictor will just respond with its latest "prediction".

    Since the RuleBasedPredictor merely reacts to numerical changes in the monitored metric, it makes no particular assumptions on the unit of the observed metric values. The RuleBasedPredictor does not need to be aware of what the metric represents, it works the same regardless of if it monitors a stream of observed response times or a stream of CPU utilization pool average values.

    See Also:
    ScalingRule
    • Field Summary

      • Fields inherited from class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor

        logger
    • Constructor Summary

      Constructors 
      Constructor Description
      RuleBasedPredictor​(org.slf4j.Logger logger, com.elastisys.scale.commons.eventbus.EventBus eventBus, com.elastisys.autoscaler.core.monitoring.api.MonitoringSubsystem monitoringSubsystem)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void applyConfig​(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig newConfig)  
      java.util.Optional<com.elastisys.autoscaler.core.prediction.api.types.Prediction> doPrediction​(java.util.Optional<com.elastisys.scale.cloudpool.api.types.PoolSizeSummary> poolSize, org.joda.time.DateTime predictionTime)  
      void onStart​(com.elastisys.autoscaler.core.monitoring.metricstreamer.reader.MetricStreamReader metricReader)  
      void onStop()  
      void validateConfig​(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig configuration)  
      • Methods inherited from class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor

        configure, getConfiguration, getConfigurationClass, getEventBus, getStatus, isConfigured, isStarted, predict, start, stop, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RuleBasedPredictor

        @Inject
        public RuleBasedPredictor​(org.slf4j.Logger logger,
                                  com.elastisys.scale.commons.eventbus.EventBus eventBus,
                                  com.elastisys.autoscaler.core.monitoring.api.MonitoringSubsystem monitoringSubsystem)
    • Method Detail

      • validateConfig

        public void validateConfig​(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig configuration)
                            throws java.lang.IllegalArgumentException
        Specified by:
        validateConfig in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
        Throws:
        java.lang.IllegalArgumentException
      • applyConfig

        public void applyConfig​(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig newConfig)
                         throws java.lang.IllegalArgumentException
        Specified by:
        applyConfig in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
        Throws:
        java.lang.IllegalArgumentException
      • onStart

        public void onStart​(com.elastisys.autoscaler.core.monitoring.metricstreamer.reader.MetricStreamReader metricReader)
        Specified by:
        onStart in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
      • onStop

        public void onStop()
        Specified by:
        onStop in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
      • doPrediction

        public java.util.Optional<com.elastisys.autoscaler.core.prediction.api.types.Prediction> doPrediction​(java.util.Optional<com.elastisys.scale.cloudpool.api.types.PoolSizeSummary> poolSize,
                                                                                                              org.joda.time.DateTime predictionTime)
                                                                                                       throws com.elastisys.autoscaler.core.prediction.api.PredictionException
        Specified by:
        doPrediction in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
        Throws:
        com.elastisys.autoscaler.core.prediction.api.PredictionException