[infinispan-dev] tomcat infinispan session manager
Manik Surtani
manik at jboss.org
Wed Dec 7 11:40:51 EST 2011
Hi there. Sorry for the late response. I know others on this list are also reviewing your code.
Some comments in-line:
On 28 Nov 2011, at 13:13, Zdeněk Henek wrote:
> Hi,
>
> I am working on prototype of https://issues.jboss.org/browse/ISPN-465.
>
> Currently works basic functionality like create session, add,update,
> remove values from session, remove session.
> Session could be with or without jvmRoute ... see details
> here:https://github.com/zvrablik/tomcatInfinispanSessionManager)
>
> I have a few questions related to infinispan.
>
> 1. classloading issue when used only one shared classloader
> ============================================
>
> Current master (https://github.com/zvrablik/tomcatInfinispanSessionManager)
> creates
> cache manager per war application. I would like use one shared cache manager.
> Is it possible?
Yes you can, however you'd need a place to register it. I'm not sure what Tomcat offers - in JBoss AS 7, it is stored as an AS 7 service. Other options may include JNDI or JMX.
>
> I have created branch
> (https://github.com/zvrablik/tomcatInfinispanSessionManager/tree/classloader)
> where only first InfinispanSessionManager create DefaultCacheManager.
>
> All created caches set explicitly class loader to configuration and
> DecoratedCache is used to access cache.
> See InfinispanSessionManager.initInfinispan method.
>
> my infinispan configuration (all created caches use default settings):
> <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:infinispan:config:5.0
> http://www.infinispan.org/schemas/infinispan-config-5.0.xsd"
> xmlns="urn:infinispan:config:5.0">
> <global>
> <transport clusterName="tomcatSession"/>
> <globalJmxStatistics enabled="true" allowDuplicateDomains="true"/>
> </global>
> <!-- use only default cache for all caches created by session manger -->
> <!-- to specify custom parameters to one cache create named cache with
> name _session_attrContainerName
> where ContainerName is name of war application -->
>
> <default>
> <jmxStatistics enabled="true"/>
> <clustering mode="distribution">
> <l1 enabled="false" lifespan="600000"/>
> <hash numOwners="2" rehashRpcTimeout="6000"/>
> <sync/>
> </clustering>
> <invocationBatching enabled="true"/>
> </default>
> </infinispan>
>
> I use tomcat 6.0.29 and Infinispan 5.1.Beta5, java 6 update 26 on
> Debian stable 64bit.
>
> I get exception on node which should replicate state sent from another node.
> See attached tomcat log.
>
> The missing class is available only through testLB war application classloader.
>
> 2. locking and distributed transactions
> ============================
> I use FineGrainedAtomicMap to store session attriubtes. I don't use
> any locking nor XA transactions.
> Do I have to use locking or XA transactions? I think autocommit mode
> could be better in this case
> and tomcat doesn't have XA manager by default. I am using distributed
> transactions only in relational databases.
Yes, you probably don't need full XA. Using Synchronizations should be enough. If you need a full transaction manager, you could pull in JBoss TS as a dependency, which is embeddable.
https://github.com/infinispan/infinispan/blob/master/parent/pom.xml#L201
https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/transaction/lookup/JBossStandaloneJTAManagerLookup.java
>
> 3. propagating session events to other nodes, sharing session metadata
> ==============================================
> Is it possible to send (broadcast) custom events through Infinispan?
No.
>
> Currently it is possible to remove session from all nodes when session
> is removed in any node,
> but there must be done more. Session timeout, session custom events ...
>
> other possible aproach is to create separated cache with session metadata.
> I think creating new cache for metadata is better approach. I think
> there will be
> less network traffic when nodes will get information only when requested.
>
> session object could have assigned listeners and broadcast events
> which are not related to session attributes.
Yes, this is possibly a better approach, however others on this list could comment more.
Cheers
Manik
--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani
Lead, Infinispan
http://www.infinispan.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20111207/1eb5d1f4/attachment-0001.html
More information about the infinispan-dev
mailing list