stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lahiru Sandaruwan <lahi...@wso2.com>
Subject Re: Deploying concurrent Applications simultaneously
Date Wed, 03 Dec 2014 04:00:04 GMT
Isuru,

Need to find out if "getLockForApplication(idOfComponent)" returns the
locks for group components as well. If not, can we do that?

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

Mime
View raw message