1 Reply Latest reply on Nov 22, 2006 11:28 PM by brian.stansberry

    PessimisticLockInterceptor performance

    pkorros

      When I use Hibernate 3.0.GA with TreeCache 1.4.0.SP1 (and 1.4.1.BETA) using a pessimistic cache configuration in local mode I see that a huge amount of time is spent inside the PessimisticLockInterceptor.

      I profiled the application and I saw that for a given set of operations that takes 23 seconds, the 98% is spent inside the lock interceptor. The following trace shows that this is because the TransactionTable uses a LinkedList to store the locks and and then it calls contains to find if a lock exists. A more performant collection should be used instead.

      Here is a part of the trace:
      org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(MethodCall) 22.125 98%
      --org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(Fqn, GlobalTransaction, int, boolean, long, boolean) 21.562 96%
      ----org.jboss.cache.TransactionTable.addLock(GlobalTransaction, IdentityLock) 21.187 94%
      ------org.jboss.cache.TransactionEntry.addLock(IdentityLock) 21.187 94%
      --------java.util.LinkedList.contains(Object) 21.187 94%
      ----org.jboss.cache.Node.acquire(Object, long, int) 187 1%
      ----org.jboss.cache.Node.getOrCreatechild(Object, GlobalTransaction, boolean) 187 1%