Hi,

When we are using ScheduledExecutorService, thread pool size is fixed.
There are only 2 factory methods to create ScheduledThreadPools, one with
single thread and one with fixed number of threads.

In our scenario, we can't predict the number clusters in advance. We have
two options.

1. We can create ScheduledThreadPool with fixed number of threads. If there
are less number of tasks, it works fine. If there are many tasks and each
tasks takes time, then tasks will be queued. It means that we are not
monitoring the cluster on time!

2. We can create ScheduledThreadPool with one thread, per cluster. If there
are 10 cluster, there will be 10 ScheduledThreadPool, each with one thread.
This way, we ensure that we are monitoring the cluster on time and there
are no idle threads. Because when the cluster is removed, we shutdown the
scheduler also.

IMO, it is crucial to monitor the cluster on time, than reusing threads?

wdyt?

Thanks

On Sun, Oct 5, 2014 at 7:56 PM, Isuru Haththotuwa <isu...@apache.org> wrote:

>
>
> On Sun, Oct 5, 2014 at 11:50 AM, Rajkumar Rajaratnam <rajkum...@wso2.com>
> wrote:
>
>> Hi,
>>
>> I have done the changes as in the previous mail.
>>
>> I am proposing one more changes to cluster monitors.
>>
>> Shall we use java executor services instead of thread sleep?
>>
> +1
>
>>
>> For example, we are sleeping the thread in cluster monitors to monitor
>> the cluster periodically.
>>
>> Instead, if we use ScheduledExecutorService, the logic would be more
>> cleaner, readable, understandable and maintainable.
>>
>> wdyt?
>>
>> Thanks.
>>
>> On Thu, Oct 2, 2014 at 8:59 PM, Rajkumar Rajaratnam <rajkum...@wso2.com>
>> wrote:
>>
>>> Hi,
>>>
>>> As discussed in the hangout, in AutoscalerHealthStatEventReceiver[1] we
>>> are checking the cluster types, and doing things accordingly like below.
>>>
>>>                 if(monitor.getClusterType() ==
>>> ClusterType.VMServiceCluster
>>>                 || monitor.getClusterType() == ClusterType.VMLbCluster)
>>> {
>>>                 //do stuff
>>>                 } else if(monitor.getClusterType() ==
>>> ClusterType.KubernetesServiceCluster) {
>>>                        //do stuff
>>>                 }
>>>
>>> IMO, better we introduce abstract methods, handleEventX(),
>>> in AbstractClusterMonitor per events.
>>>
>>> For example,
>>>
>>> handleAverageLoadAverageEvent(AverageLoadAverageEvent
>>> avgLoadAverageEvent);
>>>
>>> Then we can handle this event accordingly by overriding this method in
>>> relevant concrete monitors.
>>>
>>> It will eliminate all if/else checking in the autoscaler event receiver.
>>> Also we simply delegate the event to the relevant cluster monitor so that
>>> they can do what ever they want to do with the event, rather than doing
>>> stuffs at events receivers.
>>>
>>> wdyt?
>>>
>>> 1.
>>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatEventReceiver.java
>>>
>>> Thanks
>>>
>>> On Tue, Sep 23, 2014 at 11:43 PM, Rajkumar Rajaratnam <
>>> rajkum...@wso2.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> *Review notes*
>>>>
>>>>    - use the word kubernetes instead of docker when naming classes
>>>>    - arguments should be less than or equal to 4 (we need to add it to
>>>>    coding practices!?)
>>>>    - add licence header
>>>>    - map variables names should have a clue about the map (say,
>>>>    clusterIdToClusterMonitorMap)
>>>>    - some classes and methods missing comments
>>>>    - use complete topology event only once
>>>>    - use event names for variables instead of using 'e' (say,
>>>>    ClusterCreatedEvent)
>>>>    - find abstraction in the things we do upon receiving health stats
>>>>    events (set load avg value), to eliminate if/else
>>>>
>>>> Find the hangout video at [1]
>>>>
>>>> 1. https://www.youtube.com/watch?v=X0Jh_JCL7ZI
>>>>
>>>> Thanks.
>>>>
>>>> On Tue, Sep 23, 2014 at 7:27 PM, Chamila De Alwis <chami...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Please find the hangout at
>>>>> https://plus.google.com/hangouts/_/hoaevent/AP36tYfCemYdNWEw38lnSZqhRCIA8rqA-FTHXaP0zw9juKeBvPIxiQ?authuser=0&hl=en
>>>>>
>>>>>
>>>>> Regards,
>>>>> Chamila de Alwis
>>>>> Software Engineer | WSO2 | +94772207163
>>>>> Blog: code.chamiladealwis.com
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Sep 23, 2014 at 11:15 AM, Rajkumar Rajaratnam <
>>>>> rajkum...@wso2.com> wrote:
>>>>>
>>>>>> Hi Imesh,
>>>>>>
>>>>>> You can find more information on the mail thread "Stratos Cluster
>>>>>> Monitoring"
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> On Tue, Sep 23, 2014 at 10:38 AM, Imesh Gunaratne <im...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Rajkumar,
>>>>>>>
>>>>>>> Can you please point me to a mail thread/wiki page where we have
>>>>>>> more information on this improvement?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> On Mon, Sep 22, 2014 at 11:00 AM, Lakmal Warusawithana <
>>>>>>> lak...@wso2.com> wrote:
>>>>>>>
>>>>>>>> +1
>>>>>>>>
>>>>>>>> On Mon, Sep 22, 2014 at 4:51 PM, Rajkumar Rajaratnam <
>>>>>>>> rajkum...@wso2.com> wrote:
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> Can we have $Subject tomorrow (Tue, September 23) at 7:30 PM
>>>>>>>>> GMT+5:30 ?
>>>>>>>>>
>>>>>>>>> We will be reviewing about the changes done to existing cluster
>>>>>>>>> monitor hierarchy to allow any 'entity' cluster monitors to be 
>>>>>>>>> plugged in
>>>>>>>>> and the initial version of docker cluster monitoring.
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Rajkumar Rajaratnam
>>>>>>>>> Software Engineer | WSO2, Inc.
>>>>>>>>> Mobile +94777568639 | +94783498120
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Lakmal Warusawithana
>>>>>>>> Vice President, Apache Stratos
>>>>>>>> Director - Cloud Architecture; WSO2 Inc.
>>>>>>>> Mobile : +94714289692
>>>>>>>> Blog : http://lakmalsview.blogspot.com/
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Imesh Gunaratne
>>>>>>>
>>>>>>> Technical Lead, WSO2
>>>>>>> Committer & PMC Member, Apache Stratos
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Rajkumar Rajaratnam
>>>>>> Software Engineer | WSO2, Inc.
>>>>>> Mobile +94777568639 | +94783498120
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Rajkumar Rajaratnam
>>>> Software Engineer | WSO2, Inc.
>>>> Mobile +94777568639 | +94783498120
>>>>
>>>
>>>
>>>
>>> --
>>> Rajkumar Rajaratnam
>>> Software Engineer | WSO2, Inc.
>>> Mobile +94777568639 | +94783498120
>>>
>>
>>
>>
>> --
>> Rajkumar Rajaratnam
>> Software Engineer | WSO2, Inc.
>> Mobile +94777568639 | +94783498120
>>
>> --
>> <%2B94783498120>
>> Thanks and Regards,
>>
>> Isuru H.
>> <%2B94783498120>
>> +94 716 358 048 <%2B94783498120>* <http://wso2.com/>*
>>
>>
>> * <http://wso2.com/>*
>>
>>
>>


-- 
Rajkumar Rajaratnam
Software Engineer | WSO2, Inc.
Mobile +94777568639 | +94783498120

Reply via email to