-->
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: Which JVM cache? What about nonstrict read/write caching?
PostPosted: Wed Jul 28, 2004 11:40 am 
Regular
Regular

Joined: Fri Dec 12, 2003 2:09 pm
Posts: 84
Location: San Francisco, USA
My dev team is using Hibernate 2.1.4 and about to enable JVM caching (we're not using JTA) and have two principal questions:

1. Which cache provider should we use? We don't require clustering (yet) and so EHCache and OSCache are the most likely candidates... but I'm curious if anyone has any positive/negative experiences to share or if anyone can point me to an online comparison of the various cache providers.

2. What exactly are the semantics of nonstrict read/write caching, which the docs define as follows:

Quote:
If the application only occasionally needs to update data (ie. if it is extremely unlikely that two transactions would try to update the same item simultaneously) and strict transaction isolation is not required, a nonstrict-read-write cache might be appropriate. If the cache is used in a JTA environment, you must specify hibernate.transaction.manager_lookup_class. In other environments, you should ensure that the transaction is completed when Session.close() or Session.disconnect() is called.

What is the behavior if two transaction concurrently insert/update/delete the same item? Does one fail, do they both succeed, or is the behavior nondeterministic?

We'll test this ourselves, of course, to ensure the cache is configured and behaving as we require, but it would be great to have a better understanding of the intended behavior.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 11:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The behavior is that one transaction invalidates/updates the item in the cache, while there is still a posibility that the concurrent transaction will get the stale item. The invalidation is an asynchronous operation, without any locking.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 12:00 pm 
Regular
Regular

Joined: Fri Dec 12, 2003 2:09 pm
Posts: 84
Location: San Francisco, USA
Thanks!

So nonstrict read/write is appropriate if you don't require absolute protection from dirty reads, or if the odds of concurrent access are so slim that you're willing to accept an occassional dirty read.

Of course, same goes for dirty writes, since if one's not protected from dirty reads then one is also not protected from dirty writes.


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.