Hi Shamika,

Fixed the event.core to check authorizations before adding them. Now the
tenant loading will be faster from the second-time onwards. Meanwhile
created a JIRA to do a proper long term fix.

https://wso2.org/jira/browse/MB-269

thanks,
dimuthu

On Wed, May 29, 2013 at 5:43 AM, Dimuthu Leelarathne <dimut...@wso2.com>wrote:

> Hi Shamika,
>
>
> On Wed, May 29, 2013 at 1:17 AM, Shamika Ariyawansa <sham...@wso2.com>wrote:
>
>> Hi,
>>
>> This is occurred when authorizing user roles for the the topics
>> in org.wso2.carbon.event.core component
>>
>> for (String role : userRealm.getUserStoreManager().getRoleNames()) {
>>                     userRealm.getAuthorizationManager().authorizeRole(
>>                             role, topicStoragePath,
>> EventBrokerConstants.EB_PERMISSION_SUBSCRIBE);
>>                     userRealm.getAuthorizationManager().authorizeRole(
>>                             role, topicStoragePath,
>> EventBrokerConstants.EB_PERMISSION_PUBLISH);
>>                 }
>>
>> There are 6 roles in appfac (dev,qa, devops etc) and this authorization
>> for the topic is done for each role, which takes apprx 2 mins time.
>>
>>
> Went through the code. If there are 6 calls, this will generate 24
> database calls. How?
>
> 6 (roles) * 2 (calling authorize twice here) * 2 (we have 2 db calls in
> one authorize method, 4.1.0 code this is reduced to 1)
>
> As a fix for event.core we can avoid all of these db calls if check
> isAuthorized before adding permission. Why? Because permissions are cached.
> That way it will be slow only in the first tenant load, even then when ESB
> is released with 4.1.0 kernel it will only have 12 db calls. So only 1
> minute.
>
> thanks,
> dimuthu
>
>
>> As a solution a patch is introduced such that not to authorize these
>> roles if no topic is set in event-broker.xml.
>>
>> Thanks
>>
>>
>> On Tue, May 28, 2013 at 5:12 PM, Dimuthu Leelarathne 
>> <dimut...@wso2.com>wrote:
>>
>>> Hi Srinath,
>>>
>>> Why would the following take so much time? Can ESB run without it?
>>>
>>> thanks,
>>> dimuthu
>>>
>>> On Tue, May 28, 2013 at 4:25 PM, Shamika Ariyawansa <sham...@wso2.com>wrote:
>>>
>>>> Hi
>>>>
>>>> This timeout occurs when calling  creatingConfigurationContext method
>>>> of the the following class.
>>>>
>>>>
>>>> org.wso2.carbon.event.core.internal.builder.EventAxis2ConfigurationContextObserver
>>>>
>>>> This call is one of 20 osgi calls. All the others returned with maximum
>>>> of 1 s but this one takes about 2 mins.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, May 28, 2013 at 10:32 AM, Kishanthan Thangarajah <
>>>> kishant...@wso2.com> wrote:
>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, May 28, 2013 at 5:05 AM, Dimuthu Leelarathne <
>>>>> dimut...@wso2.com> wrote:
>>>>>
>>>>>> Hi Shamika,
>>>>>>
>>>>>> Did we try to put logs in "private static ConfigurationContext
>>>>>> createTenantConfigurationContext" in TenantAxisUtils ? We need to put 
>>>>>> debug
>>>>>> logs along the path and see what takes all the time?
>>>>>>
>>>>>
>>>>> We did put some debug logs at there as-well. But that was not the
>>>>> issue when we investigated it. The issue is, it takes 2mins for the login
>>>>> action to return and then the call comes to this method. The issue should
>>>>> be before this. So I believe we should investigate on that path.
>>>>>
>>>>> @Shamika, can you share the latest logs which explains the
>>>>> above observation?
>>>>>
>>>>>
>>>>>
>>>>>> thanks,
>>>>>> dimuthu
>>>>>>
>>>>>>
>>>>>> On Tue, May 28, 2013 at 2:38 AM, Shamika Ariyawansa <sham...@wso2.com
>>>>>> > wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Following observation was made wrt the ESB 4.6.0 instance which was
>>>>>>> spawned from the S2 ESB cartridge.
>>>>>>>
>>>>>>> 1. When the tenant user is logged for the first time the page keeps
>>>>>>> on loading and after few minutes the page gets timeout
>>>>>>> Refer the following log.
>>>>>>>
>>>>>>> TID: [0] [ESB] [2013-05-27 06:10:16,510]  INFO
>>>>>>> {org.wso2.carbon.appfactory.userstore.AppFactoryRealmConfigBuilder} -  
>>>>>>> Get
>>>>>>> the tenant ( tenant id=142) detlail.
>>>>>>> {org.wso2.carbon.appfactory.userstore.AppFactoryRealmConfigBuilder}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:10:16,522]  INFO
>>>>>>> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} -  LDAP
>>>>>>> connection created successfully in read-write mode
>>>>>>> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:10:16,561]  INFO
>>>>>>> {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService} -  
>>>>>>> Connected
>>>>>>> to mount at config in 3ms
>>>>>>> {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:10:16,690]  INFO
>>>>>>> {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService} -  
>>>>>>> Connected
>>>>>>> to mount at governance in 2ms
>>>>>>> {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:10:16,819]  INFO
>>>>>>> {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -
>>>>>>>  'ad...@admin.com@proximit_esb_1 [142]' logged in at [2013-05-27
>>>>>>> 06:10:16,818-0700]
>>>>>>> {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:12:17,207] DEBUG
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSyncAxis2ConfigurationContextObserver}
>>>>>>> -  Initializing the deployment synchronizer for tenant: 142
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSyncAxis2ConfigurationContextObserver}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:12:17,456]  INFO
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer}
>>>>>>>  -
>>>>>>>  Doing initial sync up...
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:12:17,456]  INFO
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer}
>>>>>>>  -
>>>>>>>  Checking out...
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer}
>>>>>>> TID: [0] [ESB] [2013-05-27 06:12:17,456] DEBUG
>>>>>>> {org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer}
>>>>>>>  -
>>>>>>>  Started checkout to /mnt/
>>>>>>> 10.98.175.203/wso2esb-4.6.0/repository/tenants/142 {org.w
>>>>>>>
>>>>>>>
>>>>>>> The time gap between the highlighted parts is more than two minutes.
>>>>>>>
>>>>>>> 2. After that first attempt (which was unsuccessful due to
>>>>>>> timeout) the second attempt for the same tenant logs into the
>>>>>>> system successfully without any delays. Deployment synchronization was 
>>>>>>> also
>>>>>>> happened correctly.
>>>>>>>
>>>>>>> Any idea why this error happened in the first attempt?
>>>>>>>
>>>>>>> Thanks
>>>>>>> --
>>>>>>> Shamika Ariyawansa
>>>>>>> Senior Software Engineer
>>>>>>>
>>>>>>> Mob:+ 94 772929486
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dimuthu Leelarathne
>>>>>> Architect & Chair of Solution Management Committee
>>>>>>
>>>>>> WSO2, Inc. (http://wso2.com)
>>>>>> email: dimut...@wso2.com
>>>>>> Mobile : 0773661935
>>>>>>
>>>>>> Lean . Enterprise . Middleware
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Kishanthan Thangarajah*
>>>>> Senior Software Engineer,
>>>>> Platform Technologies Team,
>>>>> WSO2, Inc.
>>>>> lean.enterprise.middleware
>>>>>
>>>>> Mobile - +94773426635
>>>>> Blog - *http://kishanthan.wordpress.com*
>>>>> Twitter - *http://twitter.com/kishanthan*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Shamika Ariyawansa
>>>> Senior Software Engineer
>>>>
>>>> Mob:+ 94 772929486
>>>>
>>>
>>>
>>>
>>> --
>>> Dimuthu Leelarathne
>>> Architect & Chair of Solution Management Committee
>>>
>>> WSO2, Inc. (http://wso2.com)
>>> email: dimut...@wso2.com
>>> Mobile : 0773661935
>>>
>>> Lean . Enterprise . Middleware
>>>
>>
>>
>>
>> --
>> Shamika Ariyawansa
>> Senior Software Engineer
>>
>> Mob:+ 94 772929486
>>
>
>
>
> --
> Dimuthu Leelarathne
> Architect & Chair of Solution Management Committee
>
> WSO2, Inc. (http://wso2.com)
> email: dimut...@wso2.com
> Mobile : 0773661935
>
> Lean . Enterprise . Middleware
>



-- 
Dimuthu Leelarathne
Architect & Chair of Solution Management Committee

WSO2, Inc. (http://wso2.com)
email: dimut...@wso2.com
Mobile : 0773661935

Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to