[jboss-user] [JBoss Cache Users] - Re: How to prevent TimeoutException?

galder.zamarreno@jboss.com do-not-reply at jboss.com
Wed Dec 2 09:35:36 EST 2009


As indicated in the documentation, JBoss Cache uses lock stripping by default and you can control the shared pool of locks by tweaking the concurrency level, as you already did. However, lock striping, under certain circumstances, can lead to deadlocks as indicated in https://jira.jboss.org/jira/browse/JBCACHE-1494. So, something good to try is to run your benchmark with:

<locking .... useLockStriping="false" /> 

More generally, debugging TimeoutExceptions involves generally producing some thread dumps when these are reported. The idea here is finding out which other thread might be holding that particular lock and see whether it's hanged or waiting for something else and see if that other resource can be tweaked accordingly.

Tools like JVisualVM (part of the jdk) can both generate and analyse thread dumps, otherwise you can use the rudimentary kill -3 or equivalent method and use standalone tools like to inspect them, i.e.:
- TDA (https://tda.dev.java.net/) 
- or Samurai (http://yusuke.homeip.net/samurai/en/index.html)

Other tips to get around TimeoutExceptions include reducing the transactional scope of the operation that is holding the lock. That way, the time the lock is held is reduced and hence it's released earlier. Reducing the transactional scope can be achieved by either moving some operations out of the transaction or finding more efficient ways to do what is being done within the transaction.

Sometimes these TimeoutException can hide behind memory issues that produce long garbage collection periods. Turning on garbage collection logging (http://www.jboss.org/community/docs/DOC-12451)  can help visualise whether there are noticeable stoppages. Turning on VM parameters can sometimes help reduce the stoppages which in turn increases speed of operation and consequently reduces TimeoutException occurrences.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268551#4268551

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268551



More information about the jboss-user mailing list