Hi all,

As explained in the thread "[CARBON][APIM] Replicating sessions in a API
manager cluster", we did a testing with sharing sessions in a cluster using
CarbonTomcatSessionReplicationValve [1]. For publisher and store worked as
expected.

But for the keymanager node, it didn't work as expected. The root cause for
blocking the approaches described in the above thread and http-session
replication is that the http-session we have in carbon is not serializable.
The session has three objects which are not serializable.

1. org.wso2.carbon.ui.DefaultCarbonAuthenticator
2. org.wso2.carbon.ui.MenuAdminClient
3. org.wso2.carbon.registry.core.session.UserRegistry

I serialized DefaultCarbonAuthenticator, MenuAdminClient with a patch.
But the object tree in the UserRegistry instance under the key "
WSO2RegistryRoot" in the http-session is simply hard to manage by patching.
I tried to do that but it ends up patching 5 components.

1. org.wso2.carbon.ndatasource.rdbms
2. org.wso2.carbon.registry.core
3. org.wso2.carbon.registry.search
4. org.wso2.carbon.ui
5. org.wso2.carbon.user.core

AFAIK, it is a bad practice to keep unserializable objects in the session.
We could use something like Redis session sharing
<https://discuss.pivotal.io/hc/en-us/articles/206085337-How-to-setup-Redis-Session-Manager-on-tcServer-Tomcat>
[2]
if the session was serializable. This could also solve the problem in
depending on the stickiness of load balancers in a clustering environment.
( Additionally, performance issues in using the
CarbonTomcatSessionReplicationValve in stores and publishers could have
been easily solved using the same kind of approach)

Shouldn't we design the session in a serializable manner? What are the
limitations doing so?

[1] https://docs.wso2.com/display/CLUSTER420/Enabling+
HTTP+Session+Replication
[2]
https://discuss.pivotal.io/hc/en-us/articles/206085337-How-to-setup-Redis-Session-Manager-on-tcServer-Tomcat

Thanks & Regards

-- 
-- 
Hareendra Chamara (BSc.Eng(Hons))
Sysco acceleration,
SyscoLabs(Pvt) Ltd
Mobile : +94 (0) 767 184161 <94767184161> | +65 (9) 425 2874 <6594252874>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to