-->
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.  [ 3 posts ] 
Author Message
 Post subject: Query caching and swarm cache
PostPosted: Fri Jan 07, 2005 9:53 pm 
Newbie

Joined: Fri Oct 15, 2004 4:17 pm
Posts: 2
Hibernate version:
2.1.7c

I've read a previous post relating to query caching and the various cache providers here, but didn't want to revive that old thread. My question relates to Hibernate's query caching mechanism, and in particular, the SwarmCache provider. I've been tracing through the Hibernate source and debugging my application today, and I can't figure out why the query cache doesn't work with the SwarmCache provider. Is it still true that the SwarmCache provider does not support query caching? If so, I'm looking for details as to why that is the case.

After tracing through the Hibernate source, I've determined that StandardQueryCache is used for the default query cache (with a null region) as well as for the named-region query caches. Each StandardQueryCache contains a Cache built from the CacheProvider defined in the settings. In my case, the CacheProvider is a SwarmCacheProvider. Each StandardQueryCache also contains an updateTimestampsCache that also has an underlying SwarmCache implementation (using the same CacheProvider). Since each of the underlying caches in the QueryCache is a SwarmCache, I'm a bit confused as to why the cache invalidations are not working across servers.

For example, when I explicitly evict cached queries for a region via SessionFactory.evictQueries(regionName), this just clears the queryCache for the specified region. Since the underlying implementation is a SwarmCache, I would think that this would evict the queries across servers (via IP multicast/JGroups), no? Similarly, when Hibernate updates the updateTimestampsCache, wouldn't this also work across servers?

The one potential problem that I can see is that Hibernate only ever does puts into the updateTimestampsCache (except when clearing the updateTimestamps cache if there aren't any named cache regions in use for query caching). If you use named cache regions, then Hibernate doesn't do any explicit clears of the updateTimestampsCache. SwarmCache doesn't send out multicast messages notifying of cache puts unless there is already an object in the local cache. Is this one issue the reason that SwarmCache isn't supported by query caching in Hibernate? If that's the case, is there anything that you can think of that we can do to work around this limitation? Have Hibernate developers considered adding query caching support for SwarmCache, or is this limitation an issue they're leaving up to SwarmCache to fix?

I'm just curious what other developers think the best route is to go to address these issues. Thanks in advance for any input you can provide :)

Brian Lenz


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 8:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Since SwarmCache does clustered eviction instead of clustered replication, it is impossible to keep the UpdateTimestampsCache valid across the whole cluster. So SwarmCache is not useable with the query cache.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 8:58 pm 
Newbie

Joined: Fri Oct 15, 2004 4:17 pm
Posts: 2
Thanks for the confirmation, Gavin.


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

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.