7 Replies Latest reply on Nov 11, 2013 11:43 AM by andy.miller

    Instantiation of new Throwable in TxConnectionListener.TransactionSynchronization

    lbarreiro

      Hi,

       

      During a performance evaluation to an high load application, one thing that showed up in the profile data was the initialization of org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.TransactionSynchronization class.

       

      The current workload generates 8000 of these objects each second. With each one of them there is an new Throwable being instantiated (from the records available, it never gets thrown). The cost of instantiating a Throwable object is far greater than throwing it or instantiate a regular object due to the way the JVM collects the stack trace.

       

      For our use case, the best is that the Throwable is only instantiated if it is to be thrown. Looking at the source code, it's possible to do that. Here is my naive attempt to do it.

       

      While I understand that the way the code works now can give useful debug information in some multi-thread environments, it can also be misleading as you are providing a stack trace that it's not related to the current code being executed. If that info is considered important I would suggest that in that case record other information (like the thread name, for example) instead of the full stack trace.

       

      Some more free CPU cycles would certainly help in the quest of running this application at an even higher load.

       

      Running ironjacamar-1.0.20.Final-redhat-1

       

      Thanks in advance,