I think we can solve it better by adding an "else" part to the logic,
We can increase the required number instance by one in the case of "max=min". Then it will send the maxOut event in rule evaluation since it is checked already. I'll change the commit as follows, if(instanceRange != 0){ float gradient = scalingRange / instanceRange; numberOfAdditionalInstancesRequired = (predictedValue - threshold) / gradient; } else { if(predictedValue > threshold){ return max + 1; } } Thanks. On Sun, Dec 21, 2014 at 4:21 PM, Lahiru Sandaruwan <lahi...@wso2.com> wrote: > Hi Reka, > > > On Sun, Dec 21, 2014 at 1:18 PM, Reka Thirunavukkarasu <r...@wso2.com> > wrote: > >> Hi Lahiru, >> >> I saw the following code when calculating required instances. Since it is >> checking the instanceRange > 0, whenever the cluster instance reaches it >> maximum, this instanceRange is 0. >> > > We get the instance range from "max = min". If we remove this check, it > may divide a value from Zero, which will cause infinity(a very large value) > in Java. > > So IMO we should handle the the "max = min" case in drools file > separately. We can send the max out event if predicted value is higher than > threshold in this case. I will implement it. > > Thanks. > >> At that point even though the load is high no decision is taken as the >> required instances is not getting calculated. Also, it is not notifying the >> parent as well even though it is max out. >> >> Shall we remove this check which will help to predict the required >> instances even when the max is reached. So that we can notify the parent >> about the max out. >> >> Thanks, >> Reka >> >> -- >> Reka Thirunavukkarasu >> Senior Software Engineer, >> WSO2, Inc.:http://wso2.com, >> Mobile: +94776442007 >> >> >> > > > -- > -- > Lahiru Sandaruwan > Committer and PMC member, Apache Stratos, > Senior Software Engineer, > WSO2 Inc., http://wso2.com > lean.enterprise.middleware > > email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/ > linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146 > > -- -- Lahiru Sandaruwan Committer and PMC member, Apache Stratos, Senior Software Engineer, WSO2 Inc., http://wso2.com lean.enterprise.middleware email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/ linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146