Tuesday, November 19, 2013

How Clustering and caching effect for WSO2 API Manager 1.2.0 distributed deployment

So here is a small description about caching and clustering configurations and parameters we used in WSO2 API manager. Lets see how clustering and caching effects for API manager.  1.2.0.

Effect of tribes clustering := Clustering must be enabled for gateways and all should clustered to single clustering domain, otherwise throttling replication will not happen.
Effect of cache enable:= There is no effect on caching if we don't use validation information cache at gateway.
Effect of synchronizeAll parameter in axis2.xml:= This doesn't have any effect on throttling information replication. Throttling information replication happens through axis2 context(according to throttle code) and there is no effect on this parameter. So we can set this as false for gateway nodes.

Key manager
For key manager clustering should be enabled as we send cluster messages to invalidate cache. And we need to enable replicate cache for API key manager nodes as oauth2 cache is a replicated cache. Also we checked synch or asynch mode of replicate cache and didn't noticed any issues in the system.
SynchronizeAll parameter in axis2.xml doesn't have any effect for key manager nodes.

Enable async replicated cache mode can be done by setting sync property in cache.xml as false. According to infinity span documents, if Infinispan is configured in async mode, the cache will become inconsistent when the same key is modified by two peers at the same time. But inside our code we do not update cache elements ,instead of that we will invalidate old objects. So both asynch and synch should work fine with API manager.

In addition to that we have introduced complete new caching mechanism from API manager 1.5.0 onwards. Now we have JSR 107 (JCache) based caching implementation which has been implemented on top of Hazelcast. All components which were using the older infinispan & ehcache based implementations now changed to this new implementation.

No comments:

Post a Comment