-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Does maxNodes/LRUPolicy affect queries? I'm losing records.
PostPosted: Tue Mar 04, 2008 2:40 pm 
Newbie

Joined: Wed Mar 01, 2006 3:23 pm
Posts: 8
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.