EJB3 is slow when invoke with new transaction
kalaiselvamp Feb 26, 2013 7:10 PMHi,
We have EJB(EJB3.0) application which is deployed on JBoss 5.0, we feel sometimes(when invoke with new transaction) EJB takes long time to return the data(data volume is always same) to invoker.
@Stateless(name = "RequiresNewSessionBean")
@RemoteBinding (jndiBinding = "N_All/RequiresNewSessionBean/remote")
@LocalBinding (jndiBinding = "N_All/RequiresNewSessionBean/local")
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
com.test.ejb.RequiresNewSessionBean
com.test.ejb.LocalSessionBeanInvoker (this class has only invoking parts) will invoke "com.test.ejb.RequiresNewSessionBean"
As you see the below 3 scenarios, execution of "com.test.ejb.RequiresNewSessionBean" has been finished but it takes time to return to invoker.
The time taken is changing from "8 ms" to maximum "150 ms" in my local system.
But in our production server this time taken is went up to "3000 ms" (only sometimes not all the times, by default it will be within 1 ~ 2 ms in Production server)
Please share your suggestions to overcome this issue.
Scenario 1
----------
17:02:15,052 DEBUG [LocalSessionBeanInvoker] 20130225-080213979 0001 com.test.ejb.LocalSessionBeanInvoker has started.20130225080215052
17:02:15,054 DEBUG [RequiresNewSessionBean] 20130225-080213979 0001 com.test.ejb.RequiresNewSessionBean has started.20130225080215053
17:02:15,094 DEBUG [RequiresNewSessionBean] 20130225-080213979 0001 com.test.ejb.RequiresNewSessionBean has finished.20130225080215093
17:02:15,094 DEBUG [RequiresNewSessionBean] 20130225-080213979 0001 [com.test.ejb.RequiresNewSessionBean]Elapsed time is 41 ms.
17:02:15,101 DEBUG [LocalSessionBeanInvoker] 20130225-080213979 0001 com.test.ejb.LocalSessionBeanInvoker has finished.20130225080215101
17:02:15,101 DEBUG [LocalSessionBeanInvoker] 20130225-080213979 0001 [com.test.ejb.LocalSessionBeanInvoker]Elapsed time is 49 ms.
Scenario 2
----------
17:11:35,343 DEBUG [LocalSessionBeanInvoker] 20130225-081135291 0001 com.test.ejb.LocalSessionBeanInvoker has started.20130225081135343
17:11:35,344 DEBUG [RequiresNewSessionBean] 20130225-081135291 0001 com.test.ejb.RequiresNewSessionBean has started.20130225081135344
17:11:35,402 DEBUG [RequiresNewSessionBean] 20130225-081135291 0001 com.test.ejb.RequiresNewSessionBean has finished.20130225081135402
17:11:35,402 DEBUG [RequiresNewSessionBean] 20130225-081135291 0001 [com.test.ejb.RequiresNewSessionBean]Elapsed time is 53 ms.
17:11:35,417 DEBUG [LocalSessionBeanInvoker] 20130225-081135291 0001 com.test.ejb.LocalSessionBeanInvoker has finished.20130225081135417
17:11:35,417 DEBUG [LocalSessionBeanInvoker] 20130225-081135291 0001 [com.test.ejb.LocalSessionBeanInvoker]Elapsed time is 71 ms.
Scenario 3
----------
17:32:25,705 DEBUG [LocalSessionBeanInvoker] 20130225-083225641 0001 com.test.ejb.LocalSessionBeanInvoker has started.20130225083225705
17:32:25,708 DEBUG [RequiresNewSessionBean] 20130225-083225641 0001 com.test.ejb.RequiresNewSessionBean has started.20130225083225708
17:32:25,775 DEBUG [RequiresNewSessionBean] 20130225-083225641 0001 com.test.ejb.RequiresNewSessionBean has finished.20130225083225775
17:32:25,775 DEBUG [RequiresNewSessionBean] 20130225-083225641 0001 [com.test.ejb.RequiresNewSessionBean]Elapsed time is 67 ms.
17:32:25,789 DEBUG [LocalSessionBeanInvoker] 20130225-083225641 0001 com.test.ejb.LocalSessionBeanInvoker has finished.20130225083225789
17:32:25,789 DEBUG [LocalSessionBeanInvoker] 20130225-083225641 0001 [com.test.ejb.LocalSessionBeanInvoker]Elapsed time is 84 ms.