Saturday, June 21, 2014

WSO2 ESB caching in Tenants

Overview

We use registry to store resources which will be used by artifacts deployed in WSO2 Products .This post describes some issues when enable or disable caching in WSO2 ESB.

Issue in Tenants' Cache


Often you will use registry resources in ESB artifacts. As an example you can store WSDLs, endpoints in registry and implement your proxies to use them. ESB registry caching works perfectly in super tenant mode but in other tenants you will come up with caching issues. If you enable caching registry resource updates should come same time but when disable if need to wait caching timeout (small time) to use newest version of resource. In tenant mode even you enable or disable caching registry resources updates will not use by ESB artifacts(proxies) until server restart. As an example if registry resource updated in one tenant (ex. endpoint), the ESB proxies in the same tenant still use the old version.

Reason for issue


This is because cachableDuration parameter is missing in the tenants's registry.xml file . This cache parameter is for registry configuration for Apache synapse. Since this parameter is missing it will still load old cache resources until server restart , even you disable the registry cache. 


Solution for issue


You can fix this by put this configuration parameter to registry.xml of all tenants as follows.

Step 1 


Go to <ESB_HOME>/repository/tenants/<Tenant ID>/synapse-configs/default/registry.xml

Step 2 


Add
<parameter name="cachableDuration">15000</parameter>
into <registry> element in registry.xml. It should be looked like this.

<registry xmlns="http://ws.apache.org/ns/synapse"
          provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>

Step 3 


put missing parameter to registry.xml like step 2 for all tenants and restart server to apply changes. 

For your information this parameter is already contain in the super tenant registry configuration. That is why super tenant proxies have latest registry updates. You can find it in <ESB_HOME>/repository/deployment/server/synapse-configs/default/registry.xml. 

Recommended cachableDuration is 15000ms.
This is known issue in WSO2 ESB and already has jira created for this[1] and in progress. We will fix this issue in our next release.

[1]https://wso2.org/jira/browse/ESBJAVA-3039

No comments :

Post a Comment