-->
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: Second level cache question
PostPosted: Mon Jan 08, 2007 1:29 pm 
Newbie

Joined: Mon Jan 08, 2007 10:28 am
Posts: 11
Hibernate version: 3.2.1
JBossCache version: 1.4.1.CR1

My application is really simple and work for all CRUD operations.

I want to configure a second level cache (with JBossCache provider) in asynchronous replication mode.

Hibernate configuration:
- hibernate.cache.provider_class=org.hibernate.cache.OptimisticTreeCacheProvider
- objects are cached in transactional mode (<class...><cache usage="transactional"/>...</class>)
- queries are cached (q.setCacheMode(true))

JBossCache configuration:
- OPTIMISTIC NodeLockingScheme
- REPL_ASYNC CacheMode

To test the second level cache operations in clustered environment, I launch two instances of the application on two differents server.
I also trace the real SQL operations with P6spy so I can see when the datasource or cache is used.

I can see via the JMX console that the two caches are replicated. So if I execute a query on ServerA, I can see the corresponding nodes (entities and query) on the ServerA and the ServerB caches.
If I re-execute the same query on ServerA, the results in cache are used by Hibernate, instead of database, so it's correct.
But if I execute the same query on ServerB, Hibernate doesn't use the result in cache but execute SQL query on database. (The operation is correct the next time.)

After an update (not already delete beacause of the problem here : http://forum.hibernate.org/viewtopic.php?t=969417&sid=a4a053a879cf63d141dcabebb344a2d4) on a persistant object, the two queries which contain the object as a part of the result are invalidated, so the process is correct.

So the clustered cache contains two nodes of every query executed both sides. The behaviour seems is like an invalidation mode where every cache is different. Only delete and update operations prevents the other cache(s) to invalid the object if it's already loaded. Hibernate doesn't profit of the replication.

Can somebody confirm that it's not a configuration problem ?
Is it a normal way of the process ?


Rudy KROL


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.