stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reka Thirunavukkarasu <r...@wso2.com>
Subject Re: Deploying concurrent Applications simultaneously
Date Wed, 03 Dec 2014 04:43:34 GMT
+1 to use hierarchical locking in the applications Topology as well. That
will improve the performance in lot of places..

Thanks,
Reka

On Wed, Dec 3, 2014 at 9:55 AM, Isuru Haththotuwa <isuruh@apache.org> wrote:

> Hi Lahiru,
>
> On Wed, Dec 3, 2014 at 9:30 AM, Lahiru Sandaruwan <lahirus@wso2.com>
> wrote:
>
>> Isuru,
>>
>> Need to find out if "getLockForApplication(idOfComponent)" returns the
>> locks for group components as well. If not, can we do that?
>>
> When you lock an application, the entire application hierarchy
> (application + any sub groups will be locked). However, you need to lock
> the clusters separately, as Applications model and Topology model are
> maintained separately.
>
>>
>> Thanks.
>>
>> On Wed, Dec 3, 2014 at 9:27 AM, Lahiru Sandaruwan <lahirus@wso2.com>
>> wrote:
>>
>>> We already have hierarchical locking. It seems some points we can
>>> improve the usage,
>>>
>>> E.g. In StatusChecker class,
>>>
>>> Following code,
>>>
>>>         try {
>>>
>>>             *ApplicationHolder.acquireWriteLock();*
>>>
>>>             if (idOfComponent.equals(appId)) {
>>>
>>>                 //it is an application
>>>
>>>                 component = ApplicationHolder.getApplications().
>>>
>>>                         getApplication(appId);
>>>
>>>             } else {
>>>
>>>                 //it is a group
>>>
>>>                 component = ApplicationHolder.getApplications().
>>>
>>>
>>> getApplication(appId).getGroupRecursively(idOfComponent);
>>>
>>>             }
>>>
>>>             groups = component.getAliasToGroupMap();
>>>
>>>             clusterData = component.getClusterDataMap();
>>>
>>>             if(component.isGroupScalingEnabled()) {
>>>
>>>                 //TODO
>>>
>>>                 handleStateWithGroupScalingEnabled();
>>>
>>>             } else {
>>>
>>>                 handleStateChangeGroupScalingDisabled(component, appId,
>>> instanceId, groups, clusterData);
>>>
>>>             }
>>>
>>>         } finally {
>>>
>>>            * ApplicationHolder.releaseWriteLock();*
>>>
>>>         }
>>>
>>> Can be improved as,
>>>         try {
>>>             *ApplicationHolder.acquireReadLock();*
>>>             if (idOfComponent.equals(appId)) {
>>>                 //it is an application
>>>                 component = ApplicationHolder.getApplications().
>>>                         getApplication(appId);
>>>             } else {
>>>                 //it is a group
>>>                 component = ApplicationHolder.getApplications().
>>>
>>> getApplication(appId).getGroupRecursively(idOfComponent);
>>>             }
>>>         } finally {
>>>
>>>            * ApplicationHolder.acquireReadLock();*
>>>         }
>>>         try{
>>>
>>>
>>> *ApplicationLockHierarchy.getInstance().getLockForApplication(idOfComponent).acquireWriteLock();*
>>>             groups = component.getAliasToGroupMap();
>>>             clusterData = component.getClusterDataMap();
>>>
>>>             if(component.isGroupScalingEnabled()) {
>>>                 //TODO
>>>                 handleStateWithGroupScalingEnabled();
>>>             } else {
>>>                 handleStateChangeGroupScalingDisabled(component, appId,
>>> instanceId, groups, clusterData);
>>>             }
>>>         } finally {
>>>
>>>
>>> *ApplicationLockHierarchy.getInstance().getLockForApplication(idOfComponent).releaseWritelock();*
>>>         }
>>>
>>> On Wed, Dec 3, 2014 at 6:45 AM, Nirmal Fernando <nirmal070125@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> AFAIS, currently all the Applications statically uses an org.apache.stratos.autoscaler.applications.ApplicationHolder
>>>> object and acquires locks before reading from/writing to it.
>>>>
>>>> After going through the places we acquire locks, it appears that
>>>> deploying concurrent Applications will lead lot of Applications to wait so
>>>> long to get started. Is my observation correct?
>>>>
>>>>
>>>> ‚Äč
>>>>
>>>> --
>>>> Best Regards,
>>>> Nirmal
>>>>
>>>> Nirmal Fernando.
>>>> PPMC Member & Committer of Apache Stratos,
>>>> Senior Software Engineer, WSO2 Inc.
>>>>
>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>
>>>
>>>
>>>
>>> --
>>> --
>>> Lahiru Sandaruwan
>>> Committer and PMC member, Apache Stratos,
>>> Senior Software Engineer,
>>> WSO2 Inc., http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> email: lahirus@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: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in:
>> http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>> --
>> <http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146>
>> <http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146>
>> Thanks and Regards,
>>
>> Isuru H.
>> <http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146>
>> +94 716 358 048 <http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146>*
>> <http://wso2.com/>*
>>
>>
>> * <http://wso2.com/>*
>>
>>
>>


-- 
Reka Thirunavukkarasu
Senior Software Engineer,
WSO2, Inc.:http://wso2.com,
Mobile: +94776442007

Mime
View raw message