[hibernate-users] Newbie Performance Questions
Eric Kolotyluk
eric.kolotyluk at gmail.com
Sun Aug 14 19:11:14 EDT 2011
I have been using Hibernate since January 2011, but more recently I am
integrating things into some UI. For some context I have an application
that deals with libraries of colors.
Our current application stores the libraries in XML files under Castor
on the local file system. A given library has 2,000 colors in it and
takes maybe 200 ms to load.
My JPA framework looks something like
@Entity Library - m2m - @Entity Color - m2m - @Entity Representation
(i.e. L*a*b*)
In my application, loading from a PostgreSQL database via Hibernate the
same data takes
1. 20 seconds to load with full logging enabled
2. 16 seconds to load with logging disabled
3. 4 seconds to reload a second time (probably due the default caching
behavior)
4. 0.2 seconds from via SQL from PostgreSQL
5. 0.2 seconds to load from Castor
6. 0 seconds (usually) if I use SoftReferences to cache the data in memory
Some of my questions are:
1. Is the performance I am seeing typical? Is it what most people would
agree to expect from using Hibernate with a DBMS like PostgreSQL?
2. When logging is turned on, I see what looks like an obscene amount
of SQL produced for only 2,000 colors. When logging is turned off,
16 seconds still seems like an awfully long time to load 2,000 color
representations, where running an SQL query to extract the same data
takes 203 ms.
3. What exactly is taking so long? Using Hibernate I basically load the
library object, then iterate over all the colors it has, then for
each color object I get the representation object and load the
L*a*b* data into the UI.
4. Am I making some lame newbie mistake somewhere, and what would that
mistake be?
5. Should I be formulating an appropriate HQL statement, similar to my
SQL statement, and loading things that way?
6. Is there some documentation on using Hibernate with Graphical User
Interfaces, or some best practices documentation somewhere?
Cheers, Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-users/attachments/20110814/3b7cb265/attachment.html
More information about the hibernate-users
mailing list