users@glassfish.java.net

Re: Very low performance with Glassfish 3.1.2 and Java EE + Hibernate

From: Andreas Loew <Andreas.Loew_at_oracle.com>
Date: Tue, 09 Oct 2012 13:04:58 +0200

Am 06.10.2012 21:58, schrieb forums_at_java.net:
> I faced with very very low performance of Java EE (EJB + JSF)
> application and
> Hibernate(3.6.8.Final and 4.1.7.Final) on Glassfish 3.1.2. Sending
> about 300
> select queries takes about 20 seconds. This is unacceptable. I have
> exactly
> the same application deployed on JBoss and TomEE. There, the same 300
> select
> queries takes about 1,5 second.
Please try and run your code on Glassfish using a Java profiler of your
choice in CPU profiling mode to see where you are losing all that time.

If you can't make any sense out of the results yourself, then please
report back to this list where all the time gets lost according to the
profiler - we then may be able to help you figure out what is going
wrong here...

> I found in google some answers that maybe
> hibernate.show_sql is true or hibernate.hbm2ddl make application soo
> slow.
> But it is not true. I turned off hibernate.show_sql but is doesn't
> matter.
> Moreover, these options are true in the JBoss and TomEE versions and
> it works
> over 10 times faster! I thought that this is the issue between
> Glasfish and
> Hibernate. But I have the next application with the same business
> logic, the
> same DAO with EntityManager provided by Hibernate but configurated with
> Spring. And the performance is great. It is weird, isn't it?
Yes, it indeed is. Completely unexpected. That's why you need to use the
CPU profiler to see what is going on.

HTH & best regards,

Andreas

-- 
Andreas Loew | Senior Java Architect
ORACLE Germany