Speed of bmp entity bean method calls
kismorc Mar 17, 2006 4:47 AMHi Guys,
We have a problem with speed of BMP entity bean method calls. We use jboss-4.0.2, Redhat 7.2 and Oracle 8i.
Until now, we had one session bean (UserManipulationBean) and read the DB directly via JDBC.
Now, we'd like to use entity beans (PositionBMP - using local interface class) instead of JDBC.
Before we used entity beans with standard jdbc functions the process time for acquiring data was (in milliseconds):
[2006-03-16 13:44:39,314] - processTime: 22
[2006-03-16 13:44:42,492] - processTime: 23
[2006-03-16 13:44:45,726] - processTime: 22
[2006-03-16 13:44:49,027] - processTime: 23
[2006-03-16 13:44:52,230] - processTime: 23
[2006-03-16 13:44:55,406] - processTime: 22
[2006-03-16 13:44:58,591] - processTime: 22
[2006-03-16 13:45:01,768] - processTime: 23
[2006-03-16 13:45:04,990] - processTime: 23
[2006-03-16 13:45:08,154] - processTime: 23
After (with new bmp entity bean):
[2006-03-16 13:05:29,588] - processTime: 62
[2006-03-16 13:05:32,779] - processTime: 63
[2006-03-16 13:05:35,945] - processTime: 63
[2006-03-16 13:05:39,328] - processTime: 72
[2006-03-16 13:05:42,608] - processTime: 63
[2006-03-16 13:05:45,908] - processTime: 63
[2006-03-16 13:05:49,158] - processTime: 63
[2006-03-16 13:05:52,388] - processTime: 63
[2006-03-16 13:05:55,658] - processTime: 63
Iterator iterator = localHome.findAllForUser(curentUserID).iterator(); while (iterator.hasNext()) { PositionLocal local = (PositionLocal)iterator.next(); Long currentPosition = local.getCurrentPosition(); String userID = local.getuserID(); ... }
Reading 12 records via JDBC takes us 12 ms, but to get two fields via one PositionBMP instance takes 5 ms only!
Could anyone tell me what I'm doing wrong or how to improve the speed of these method calls?
Thanks
Peter and Yoji
ejb-jar.xml
<ejb-jar> <enterprise-beans> <session> <ejb-name>UserManipulationBean</ejb-name> <home>UserManipulationHome</home> <remote>UserManipulationRemote</remote> <ejb-class>UserManipulationBean</ejb-class> <session-type>Stateful</session-type> <transaction-type>Container</transaction-type> <resource-ref> <res-ref-name>jdbc/MyDataSource</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </session> <entity> <ejb-name>PositionBMP</ejb-name> <home>PositionBMPHome</home> <remote>PositionsBMPRemote</remote> <local-home>PositionLocalHome</local-home> <local>PositionLocal</local> <ejb-class>PositionBMPBean</ejb-class> <persistence-type>Bean</persistence-type> <prim-key-class>PositionPK</prim-key-class> <reentrant>True</reentrant> <resource-ref> <res-ref-name>jdbc/MyDataSource</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </entity> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>UserManipulationBean</ejb-name> <method-name>*</method-name> </method> <method> <ejb-name>PositionBMP</ejb-name> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar>
jboss.xml
<jboss> <enterprise-beans> <entity> <ejb-name>PositionBMP</ejb-name> <jndi-name>env/ejb/PositionBMPBeanRemote</jndi-name> <local-jndi-name>env/ejb/PositionBMPBeanLocal</local-jndi-name> <configuration-name>Standard BMP EntityBean</configuration-name> <resource-ref> <res-ref-name>jdbc/MyDataSource</res-ref-name> <jndi-name>java:/MyDataSource</jndi-name> </resource-ref> </entity> </enterprise-beans> </jboss>
jbosscmp-jdbc.xml
<jbosscmp-jdbc> <defaults> <datasource>java:/MyDataSource</datasource> <datasource-mapping>Oracle8</datasource-mapping> </defaults> <enterprise-beans> </enterprise-beans> </jbosscmp-jdbc>