Hibernate version: 3.2.3 ga
JBossCache version: 1.4.1SP8
Hi all!
In a clustered environment where the second level cache is JBossCache, I’m using LRUPolicy. I’ve set maxNodes at 5000 for a particular region that represents a Hibernate object. I believe this is working because I’m using Hibernates built-in cache stats reporting and the number of entities persisted for the region gets close to but never surpasses the maxNodes. In my treecache.xml I have the following:
Code:
<attribute name=”EvictionPolicyClass”>org.jboss.cache.eviction.LRUPolicy</attribute>
<attribute name=”EvictionPolicyConfig”>
<region name=”/com/my/package/MyObject”>
<attribute name=”maxNodes”>5000</attribute>
<attribute name=”timeToLiveSeconds”>0</attribute>
</region>
</attribute>
I’m doing a non-cached query like this:
Code:
HibernateUtil.getSession().createQuery(“from MyObject where userid=’123’”).setMaxResults(50).setCacheable(false).list();
Querying the database directly outside of Hibernate I see that user 123 has three MyObjects. But in production, with high usage, I’m not seeing all of user 123’s MyObjects. I’m seeing one of three. On a test server with the same data from production and no clustering I’m correctly seeing all three of user 123’s MyObjects. I’ve verified that in production the number of MyObjects in the cache is close to the 5000 limit.
1) When Hibernate runs a query I wouldn’t expect that the maxNodes would affect the results. I mean, I could set the maxNodes to 100 for a table that has 2,000,000 records. The query should still search all 2,000,000, right?
2) My understanding is that setCacheable(false) would completely ignore the cache and make the database call… is this not true?
3) What else might be causing my missing records in production when the number of cached objects is near the maxNodes value?
Hibernate 3.2.3 ga and JBossCache 1.4.1SP8. It’s generally been working fine for months but as the load increased this boundary condition seems to be causing some issues. Any help/pointers are appreciated.
Thanks,
Joe