[jboss-user] [EJB 3.0] - Slow performance of queries and POJO mapping
do-not-reply at jboss.com
Thu Nov 23 17:56:10 EST 2006
I am comparing the performance of EJB3/Hibernate with straight JDBC calls. There seems to be an issue with the EJB3 code that maps the result set to the returned list of POJOs.
In a test of 20 threads each selecting 5000 rows, I am finding that EJB3 is about 3 times slower than the JDBC code (overall 4000 rows/sec as against 13000 rows/sec).
To exclude the underlying query being the cause, I switched to using em.createNativeQuery(sql,class) so that the exact same query was executed as with JDBC. This ran just as slow as createQuery.
I then tested using em.createNativeQuery(sql), ie without the POJO mapping, and the performance was > 10000 rows/sec.
So my conclusion is that the bottleneck is with the mapping of the result set to the list of POJOs, or perhaps with the caching of the POJOs in EntityManager (?)
Can anyone confirm this issue or suggest improvements I can make?
I am running:
Hibernate EntityManager 3.2.0.CR2
Hibernate Annotations 3.2.0.CR2
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988307#3988307
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988307
More information about the jboss-user