Second Level Cache with JBoss TreeCache
johndoe2 Jul 31, 2007 6:58 AMHi,
we use the JBoss TreeCache for the Hibernate Second Level Cache. I found out that each Second Level Cache Entity is held in a separate node (for example, there are one node for OrderType[id-1] and one node for OrderType[id-2] '/com/sales/hibernate/OrderType/com.sales.hibernate.OrderType#1' and '/com/sales/hibernate/OrderType/com.sales.hibernate.OrderType#2').
Because we have many Second Level Cache Enties our TreeCache have thousands of nodes.
I actually expected that each node is for one EntityType (OrderType.class) and the map in the node holds the Enties of this type (OrderType#1; OrderType#2).
We use JBoss 4.0.5.GA with Hibernate 3.2.4.ga.
The treecache.xml:
<?xml version="1.0" encoding="UTF-8"?> <server> <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache"> <depends>jboss:service=Naming</depends> <depends>jboss:service=TransactionManager</depends> <attribute name="IsolationLevel">REPEATABLE_READ</attribute> <attribute name="CacheMode">LOCAL</attribute> <attribute name="ClusterName">Sales_Hibernate_Cache</attribute> <!-- Max number of entries in the cache. If this is exceeded, the eviction policy will kick some entries out in order to make more room --> <attribute name="MaxCapacity">7000</attribute> <!-- The max amount of time (in milliseconds) we wait until the initial state (ie. the contents of the cache) are retrieved from existing members in a clustered environment --> <attribute name="InitialStateRetrievalTimeout">20000</attribute> <!-- Number of milliseconds to wait until all responses for a synchronous call have been received. --> <attribute name="SyncReplTimeout">10000</attribute> <!-- Max number of milliseconds to wait for a lock acquisition --> <attribute name="LockAcquisitionTimeout">15000</attribute> <!-- Max number of milliseconds we hold a lock (not currently implemented) --> <attribute name="LockLeaseTimeout">60000</attribute> <!-- Name of the eviction policy class. Not supported now. --> <attribute name="EvictionPolicyClass"></attribute> </mbean> </server>
What can i do to get the expected behavior?
Thanks,
John