I've made a first stab at implementing multiple instances. That is an
entity instance per transaction and no shared entity instances between
transactions. This code may be naive, but it seems to pass locktest,
banktest, and the mbean(threads) test. It will only work with commit option
B and C and will throw an exception if you try to run it with commit option
A.
The weird thing is is that locktest runs much slower with multi instance
than with regular when I thought it would run much faster. Attached is the
Optimizeit output if anyone is interested. It seems to slow down trying to
getEJBHome in loadEntity?
So, what are the benefits of this checkin? I thought it would increase
performance/throughput for commit options B and C since beans are not locked
into a transaction.
To try it out:
in standardjboss.xml, replace
EntityInstanceInterceptor with EntityMultiInstanceInterceptor
EntitySynchronizationInterceptor with
EntityMultiInstanceSynchronizationInterceptor
your lock-policy should be MethodOnlyEJBLock.
Look at jbosstest/src/resources/lock/META-INF/jboss.xml for configuration
examples. EntityBean_B_Multi
Regards,
Bill
Profiler output and hot spots for thread RMI TCP Connection(271)-192.168.0.152 . application org.jboss.Main (CPU profiler output - Sampler / Methods)
Backtrace

Description of CPU usage for thread RMI TCP Connection(271)-192.168.0.152

100.0% - 5862 ms - java.lang.Thread.run()

100.0% - 5862 ms - sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run()

100.0% - 5862 ms - sun.rmi.transport.tcp.TCPTransport.handleMessages()

64.48% - 3780 ms - sun.rmi.transport.Transport.serviceCall()

64.48% - 3780 ms - java.security.AccessController.doPrivileged()

64.48% - 3780 ms - sun.rmi.transport.Transport$1.run()

64.48% - 3780 ms - sun.rmi.server.UnicastServerRef.dispatch()

63.59% - 3728 ms - java.lang.reflect.Method.invoke()

63.59% - 3728 ms - org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke()

61.87% - 3627 ms - org.jboss.ejb.EntityContainer.invoke()

61.87% - 3627 ms - org.jboss.ejb.plugins.LogInterceptor.invoke()

61.87% - 3627 ms - org.jboss.ejb.plugins.SecurityInterceptor.invoke()

61.87% - 3627 ms - org.jboss.ejb.plugins.TxInterceptorCMT.invoke()

61.87% - 3627 ms - org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions()

32.13% - 1884 ms - org.jboss.tm.TransactionImpl.commit()

29.73% - 1743 ms - org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext()

29.73% - 1743 ms - org.jboss.ejb.plugins.EntityLockInterceptor.invoke()

28.02% - 1643 ms - org.jboss.ejb.plugins.EntityMultiInstanceInterceptor.invoke()

28.02% - 1643 ms - org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke()

28.02% - 1643 ms - org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject()

28.02% - 1643 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject()

28.02% - 1643 ms - org.jboss.ejb.plugins.jrmp.interfaces.EntityHandleImpl.getEJBObject()

28.02% - 1643 ms - org.jboss.ejb.plugins.jrmp.interfaces.AbstractHandle.getEJBObject()

28.02% - 1643 ms - org.jboss.ejb.plugins.jrmp.interfaces.AbstractHandle.lookupEJBHome()

28.02% - 1643 ms - javax.naming.InitialContext.lookup()

28.02% - 1643 ms - org.jnp.interfaces.NamingContext.lookup()

28.02% - 1643 ms - org.jnp.interfaces.NamingContext.lookup()

24.36% - 1428 ms - org.jnp.server.NamingServer_Stub.lookup()

3.01% - 177 ms - org.jnp.interfaces.NamingContext.checkRef()

0.64% - 38 ms - java.rmi.MarshalledObject.get()

1.7% - 100 ms - org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke()

1.7% - 100 ms - org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke()

1.7% - 100 ms - org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject()

1.7% - 100 ms - org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject()

1.7% - 100 ms - org.jboss.ejb.plugins.jrmp.interfaces.EntityHandleImpl.getEJBObject()

1.7% - 100 ms - org.jboss.ejb.plugins.jrmp.interfaces.AbstractHandle.getEJBObject()

1.7% - 100 ms - org.jboss.ejb.plugins.jrmp.interfaces.AbstractHandle.lookupEJBHome()

1.7% - 100 ms - javax.naming.InitialContext.lookup()

1.7% - 100 ms - org.jnp.interfaces.NamingContext.lookup()

1.7% - 100 ms - org.jnp.interfaces.NamingContext.lookup()

1.26% - 74 ms - org.jnp.interfaces.NamingContext.checkRef()

0.32% - 19 ms - org.jnp.server.NamingServer_Stub.lookup()

0.11% - 7 ms - java.rmi.MarshalledObject.get()

1.6% - 94 ms - java.rmi.MarshalledObject.get()

0.73% - 43 ms - sun.rmi.server.UnicastRef.unmarshalValue()

0.15% - 9 ms - sun.rmi.server.UnicastRef.marshalValue()

35.51% - 2082 ms - java.io.FilterInputStream.read()
Hot spots
Name | Percentage | Time | java.net.SocketInputStream.socketRead | 65.91 | 3864 ms |
java.lang.StringBuffer.expandCapacity | 28.26 | 1657 ms |
java.net.SocketOutputStream.socketWrite | 3.1 | 182 ms |
java.io.ObjectInputStream.readUTF | 0.85 | 50 ms |
java.io.ByteArrayInputStream.read | 0.75 | 44 ms |
java.lang.StringBuffer.length | 0.73 | 43 ms |
java.io.ObjectStreamClass.init | 0.15 | 9 ms |
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke | 0.11 | 7 ms |
java.io.ObjectInputStream.skipToEndOfBlockData | 0.1 | 6 ms |
20 clicks per test 20 untargeted tests
caller.gif