-
1. Re: Deadlock at UpdateTimeStampsCache !
brian.stansberry Sep 13, 2007 9:51 AM (in response to johnbat26)Blocking where in UpdateTimestampsCache?
You need to think carefully about whether you want to cache queries if your app is one where the entities are frequently updated. -
2. Re: Deadlock at UpdateTimeStampsCache !
johnbat26 Sep 13, 2007 10:00 AM (in response to johnbat26)I don't change DB !
I use only Selects ! -
3. Re: Deadlock at UpdateTimeStampsCache !
brian.stansberry Sep 13, 2007 10:05 AM (in response to johnbat26)OK, back to the first question: blocking where in UpdateTimestampsCache?
-
4. Re: Deadlock at UpdateTimeStampsCache !
johnbat26 Sep 13, 2007 10:26 AM (in response to johnbat26)JProfiler write that all threads wait UpdateTimeStampsCache.
So all methods in UpdateTimeStampsCache is synchronized!
I think that in isUpToDate() method. -
5. Re: Deadlock at UpdateTimeStampsCache !
johnbat26 Sep 13, 2007 10:30 AM (in response to johnbat26)I send e-mail to you
-
6. Re: Deadlock at UpdateTimeStampsCache !
johnbat26 Sep 13, 2007 10:51 AM (in response to johnbat26)I think, that deadlock appear from :
protected boolean isUpToDate(Set spaces, Long timestamp) {
if ( log.isDebugEnabled() ) {
log.debug("Checking query spaces for up-to-dateness: " + spaces);
}
return updateTimestampsCache.isUpToDate(spaces, timestamp);
}
in StandardQueryCache !
updateTimestampsCache.isUpToDate(spaces, timestamp); is SYNCHRONIZED ! -
7. Re: Deadlock at UpdateTimeStampsCache !
brian.stansberry Sep 13, 2007 11:05 AM (in response to johnbat26)You're analysis looks correct to me.
The synchronization is something to take up with the Hibernate folks on the hibernate.org forums, as its part of their general 2nd level cache management; not something controllable by JBoss Cache.
Inside isUpToDate(), before calling into JBC, the Hibernate/JBC integration layer suspends any ongoing tx and then resumes it on exit. If your query involves lots of entities, that will happen multiple times. That could be expensive.
If you find that query caching slows down your app, don't do it. :)
Also, you mentioned a deadlock. Is there a deadlock? Your discussion is of thread contention, which is not the same thing as a deadlock.