Disabling Certain Properties from Being Replicated Across a WSAS Cluster

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By Afkham Azeez
  • 28 Nov, 2007

Introduction

WSASWhen a cluster of WSAS nodes is configured, by default, all serializable objects placed in the Axis2 ConfigurationContext, ServiceGroupContext or ServiceContext will be replicated across the cluster. Any object in the system that has access to these contexts can place properties in these contexts. The most common case from the point of view of a Web service developer is the properties being placed in these contexts by the service implementation and other related objects. The Web service developer simply needs to drop the relevant objects into these contexts, and WSAS will replicate them, without the service developer having to write a single line of code related to replication. Even services written without clustering in mind can be easily clustered. Sound interesting? However, in some cases, a user may not want all of the objects placed in these contexts to be replicated. Can this be achieved? Can we configure a WSAS cluster in such a way that some properties are not replicated? During the course of this tutorial we will address these common concerns expressed by some users.

In some scenarios, replication of certain properties such as local IP address, local request count, etc., may not be desirable. The default behavior of WSAS is to replicate all serializable objects placed in the Axis2 ConfigurationContext, ServiceGroupContext or across the cluster. So we need to explicitly inform WSAS about the properties that should not be replicated across the cluster, even if they are placed in the relevant contexts.

Let's assume that clustering has been enabled on your WSAS instance. So the following segment in the axis2.xml that is included with WSAS should be familiar to you. This can be found in WSO2WSAS_HOME/conf/axis2.xml


<!-- ================================================= -->
<!-- Clustering -->
<!-- Configure and uncomment following for preparing Axis2 to a clustered environment -->
<!-- ================================================= -->
<!--
<cluster class="org.apache.axis2.clustering.tribes.TribesClusterManager">
<parameter name="AvoidInitiation">true</parameter>
<parameter name="domain">wso2wsas.domain</parameter>

<configurationManager
class="org.wso2.wsas.clustering.configuration.WSASConfigurationManager">
<parameter name="CommitTimeout">20000</parameter>
<parameter name="NotificationWaitTime">2000</parameter>
<listener class="org.wso2.wsas.clustering.configuration.WSASConfigurationManagerListener"/>
</configurationManager>


<contextManager class="org.apache.axis2.clustering.context.DefaultContextManager">
<listener class="org.apache.axis2.clustering.context.DefaultContextManagerListener"/>
<replication>
<defaults>
<exclude name="local_*"/>
<exclude name="LOCAL_*"/>
<exclude name="wso2tracer.msg.seq.buff"/>
<exclude name="wso2tracer.trace.persister.impl"/>
<exclude name="wso2tracer.trace.filter.impl"/>
</defaults>

<context class="org.apache.axis2.context.ConfigurationContext">
<exclude name="UseAsyncOperations"/>
<exclude name="SequencePropertyBeanMap"/>
<exclude name="WORK_DIR"/>
<exclude name="NextMsgBeanMap"/>
<exclude name="RetransmitterBeanMap"/>
<exclude name="StorageMapBeanMap"/>
<exclude name="CreateSequenceBeanMap"/>
<exclude name="WSO2 WSAS"/>
<exclude name="wso2wsas.generated.pages"/>
<exclude name="ConfigContextTimeoutInterval"/>
<exclude name="ContainerManaged"/>
</context>

<context class="org.apache.axis2.context.ServiceGroupContext">
<exclude name="my.sandesha.*"/>
</context>

<context class="org.apache.axis2.context.ServiceContext">
<exclude name="my.sandesha.*"/>
</context>
</replication>
</contextManager>

</cluster>

-->

Some Common Scenarios

Now let's look at some common ways by which you can configure replication avoidance.

Scenario 1

Let's assume that your service, foo, places 3 properties, foo_config_ctx, foo_sg_ctx and foo_service_ctx in the ConfigurationContext, ServiceGroupContext and ServiceContext respectively. Also let's assume that you do not want these properties to be replicated.

So in the contextManager section, we will add three entries as shown below:


<contextManager class="org.apache.axis2.clustering.context.DefaultContextManager">
<listener class="org.apache.axis2.clustering.context.DefaultContextManagerListener"/>
<replication>
<defaults>
<exclude name="local_*"/>
<exclude name="LOCAL_*"/>
<exclude name="wso2tracer.msg.seq.buff"/>
<exclude name="wso2tracer.trace.persister.impl"/>
<exclude name="wso2tracer.trace.filter.impl"/>
</defaults>

<context class="org.apache.axis2.context.ConfigurationContext">
<exclude name="UseAsyncOperations"/>
<exclude name="SequencePropertyBeanMap"/>
<exclude name="WORK_DIR"/>
<exclude name="NextMsgBeanMap"/>
<exclude name="RetransmitterBeanMap"/>
<exclude name="StorageMapBeanMap"/>
<exclude name="CreateSequenceBeanMap"/>
<exclude name="WSO2 WSAS"/>
<exclude name="wso2wsas.generated.pages"/>
<exclude name="ConfigContextTimeoutInterval"/>
<exclude name="ContainerManaged"/>
<exclude name="foo_config_ctx"/>

</context>

<context class="org.apache.axis2.context.ServiceGroupContext">
<exclude name="my.sandesha.*"/>
<exclude name="foo_sg_ctx"/>

</context>

<context class="org.apache.axis2.context.ServiceContext">
<exclude name="my.sandesha.*"/>
<exclude name="foo_service_ctx"/>

</context>
</replication>
</contextManager>

Scenario 2

Let's assume you do no want to replicate any property in the ConfigurationContext that starts with the prefix foo or ends with bar. Here is how you configure it in the contextManager section:


<contextManager class="org.apache.axis2.clustering.context.DefaultContextManager">
<listener class="org.apache.axis2.clustering.context.DefaultContextManagerListener"/>
<replication>
<defaults>
<exclude name="local_*"/>
<exclude name="LOCAL_*"/>
<exclude name="wso2tracer.msg.seq.buff"/>
<exclude name="wso2tracer.trace.persister.impl"/>
<exclude name="wso2tracer.trace.filter.impl"/>
</defaults>

<context class="org.apache.axis2.context.ConfigurationContext">
<exclude name="UseAsyncOperations"/>
<exclude name="SequencePropertyBeanMap"/>
<exclude name="WORK_DIR"/>
<exclude name="NextMsgBeanMap"/>
<exclude name="RetransmitterBeanMap"/>
<exclude name="StorageMapBeanMap"/>
<exclude name="CreateSequenceBeanMap"/>
<exclude name="WSO2 WSAS"/>
<exclude name="wso2wsas.generated.pages"/>
<exclude name="ConfigContextTimeoutInterval"/>
<exclude name="ContainerManaged"/>
<exclude name="foo*"/>
<exclude name="*bar"/>

</context>

<context class="org.apache.axis2.context.ServiceGroupContext">
<exclude name="my.sandesha.*"/>
</context>

<context class="org.apache.axis2.context.ServiceContext">
<exclude name="my.sandesha.*"/>
</context>
</replication>
</contextManager>

Note that there is an asterisk (*) after foo, to indicate that it is a prefix, and also there is an asterisk before bar, to indicate that it is a suffix.

Scenario 3

Let's assume you do not want to replicate any property in any of the contexts that starts with the prefix foo or ends with bar. To do this, you can add an entry to the defaults section. Here is how you configure it in the contextManager section:


<contextManager class="org.apache.axis2.clustering.context.DefaultContextManager">
<listener class="org.apache.axis2.clustering.context.DefaultContextManagerListener"/>
<replication>
<defaults>
<exclude name="local_*"/>
<exclude name="LOCAL_*"/>
<exclude name="wso2tracer.msg.seq.buff"/>
<exclude name="wso2tracer.trace.persister.impl"/>
<exclude name="wso2tracer.trace.filter.impl"/>
<exclude name="foo*"/>
<exclude name="*bar"/>

</defaults>

<context class="org.apache.axis2.context.ConfigurationContext">
<exclude name="UseAsyncOperations"/>
<exclude name="SequencePropertyBeanMap"/>
<exclude name="WORK_DIR"/>
<exclude name="NextMsgBeanMap"/>
<exclude name="RetransmitterBeanMap"/>
<exclude name="StorageMapBeanMap"/>
<exclude name="CreateSequenceBeanMap"/>
<exclude name="WSO2 WSAS"/>
<exclude name="wso2wsas.generated.pages"/>
<exclude name="ConfigContextTimeoutInterval"/>
<exclude name="ContainerManaged"/>
</context>

<context class="org.apache.axis2.context.ServiceGroupContext">
<exclude name="my.sandesha.*"/>
</context>

<context class="org.apache.axis2.context.ServiceContext">
<exclude name="my.sandesha.*"/>
</context>
</replication>
</contextManager>

Note that there is an asterisk (*) after foo, to indicate that it is a prefix, and also there is an asterisk before bar, to indicate that it is a suffix.

Applies To

WSO2 WSAS 2.0 & newer versions

 

More Information

Rest of the WSO2 WSAS HOWTO series

Author

Afkham Azeez, Architect & Product Manager of WSO2 WSO2 WSAS, WSO2 Inc. azeez AT wso2 DOT com

About Author

  • Afkham Azeez
  • VP, Platform Architecture
  • WSO2