[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Hibernate + Spring + JBOSS + Terracotta, cache not getting replicated  XML
Forum Index -> Terracotta for Spring
Author Message
atulgupta31

journeyman

Joined: 05/15/2009 00:28:16
Messages: 15
Offline

We are using spring, hibernate application deployed on JBOSS. Now we have decided to enable 2nd level cache of hibernate and supplement it with terracotta for clustering. So the problem we are facing is that terracotta is not replicating the changes over cluster (e.g I am creating a criteria query, if that query is getting called on one instance and lies on that instance, then that query is not getting replicated over another instance.) Only hibernate objects seems to have a problem, while other object (non-hibernate) are getting replicated successfully. I ran a sample application only with hibernate and it worked fine.

I am providing some main config files as attachment, I will be greatful to have some insights into it.

Snippet from application-context.xml

<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<!--prop key="hibernate.cache.query_cache_factory">org.hibernate.cache.StandardQueryCacheFactory</prop-->
<!-- applicationContext hibernateProperties merge-point -->
</props>
</property>

Dao Code

defects = this.getSession().createCriteria(DefectImpl.class);
defects.setCacheable(true);
defects.setCacheRegion("org.hibernate.cache.StandardQueryCache");




Version of the software-

Hibernate 3.2.5-ga
Ehcache 1.3.0
JBOSS 4.0.4 GA
Spring 2.5.6
 Filename ehcache.xml [Disk] Download
 Description ehcache.xml
 Filesize 2 Kbytes
 Downloaded:  39 time(s)

 Filename tc-config-tomcat.xml [Disk] Download
 Description tc-config.xml for jboss
 Filesize 4 Kbytes
 Downloaded:  51 time(s)

zeeiyer

consul

Joined: 05/24/2006 14:28:28
Messages: 461
Offline

Can you provide us some more detail:

- Are there any exceptions in the terracotta-client.log and terracotta-server.log
- What does the Clustered Object Graph show in the Terracotta Developer Console.

Basically, how are you concluding that Hibernate objects are not being replicated (screen shots from the Terracotta Developer Console, Log files would help) - or is it because you still see queries to the database for a certain Query. Note that Query Cache usually is fairly volatile in that Hibernate implements Entity-Type invalidation, in that all query-cache Elements that have results which include an Entity of type Foo get invalidated when any Entity of type Foo gets modified.

Thanks.

Sreeni Iyer, Terracotta.
Not a member yet - Click here to join the Terracotta Community
atulgupta31

journeyman

Joined: 05/15/2009 00:28:16
Messages: 15
Offline

Thanks a lot for your concern. Here are the details asked by you.

I dont see any exceptions in the logs, however logs are attached herein.

The reason i say it is not getting replicated is that i see same queries getting fired again and again, even i am only selects. so the same query fired again, goes to the database (on the different JVM), even if there is no data change related to that entity. On the same JVM second level cache works fine. Although i think replication is getting done, but cant get the reason why the queries are again fired on database.

Client, server logs and dev console screnshots are attached.

Any help is much appreciated.
atulgupta31

journeyman

Joined: 05/15/2009 00:28:16
Messages: 15
Offline

attachments did not get attached, so attaching them again
 Filename Dev console screenshot.doc [Disk] Download
 Description
 Filesize 490 Kbytes
 Downloaded:  35 time(s)

atulgupta31

journeyman

Joined: 05/15/2009 00:28:16
Messages: 15
Offline

all attachments not getting attached :( so attachin one by one
 Filename terracotta-server.log [Disk] Download
 Description
 Filesize 28 Kbytes
 Downloaded:  36 time(s)

atulgupta31

journeyman

Joined: 05/15/2009 00:28:16
Messages: 15
Offline

client log is big and so not getting attached, trimming it and attaching again

on examining client-logs seems like data is getting replicated as suspected, but why then additional queries.
 Filename terracotta-client.log [Disk] Download
 Description
 Filesize 406 Kbytes
 Downloaded:  39 time(s)

tkhairna

journeyman

Joined: 12/10/2008 09:32:06
Messages: 48
Location: Delhi
Offline

Hi Atul,

you may want to run again with cache debugging on.

Code:
log4j.logger.org.hibernate.cache=debug


This will show invalidation events and timestamps.
Also turn on cache statistics. either by MBean or having some background
thread print stats in log or console.

Combination would give you good picture whats happening.

Tushar

Tushar
Field Engineer
Terracotta Inc.
[Email] [WWW]
atulgupta31

journeyman

Joined: 05/15/2009 00:28:16
Messages: 15
Offline

I thought cache invalidation will only happen in the case of update/writing a new object, which i am not doing at all, are there still any cases where cache invalidation will happen beside timeout, read/write?

Also we are using criteria queries not HQL, so i am not able to get the cache statistics ad they are only available for HQL's.
 
Forum Index -> Terracotta for Spring
Go to:   
Powered by JForum 2.1.7 © JForum Team